zoukankan      html  css  js  c++  java
  • 微信小程序 WXS模块 导出和使用

    创建WXS模块

      ①在小程序页面下创建XX.wxs文件

       ②在XX.wxs文件中定义要使用的变量或方法

    使用WXS模块

      ①导入XX.wxs文件

      ②使用模块内导出的内容

    案例

    创建WXS模块内容(xx.wxs)

    1 var countPrice = function (oprice, nprice) {
    2   return (oprice - nprice).toFixed(1)
    3 }
    4 
    5 module.exports = {
    6   countPrice:countPrice
    7 }

    使用WXS模块内容(xx.wxml)

    1 <wxs src="xx.wxs路径" module="模块变量名称"></wxs>
    2 模块变量名称.countPrice(xx.oprice,xx.nprice)
    时间若流水,恍惚间逝去
  • 相关阅读:
    Linux命令:ssh
    Linux命令:sshpass
    Linux命令:ls
    Linux文件的时间
    Linux命令:findutils
    jfrog
    git
    git branch
    git remote
    java equals 和hashcode
  • 原文地址:https://www.cnblogs.com/alanshreck/p/14455544.html
Copyright © 2011-2022 走看看