本文共 2029 字,大约阅读时间需要 6 分钟。
{{}}
绑定事件,而是直接使用 bind:事件名="处理函数"
或用 v-bind
简写形式。<button bind:tap="showInfo">显示/隐藏用户信息</button>
wx:for
及 wx:key
。{ {item}}
wx:for-item
。{ {goodslist.name}}
{ {goodslist.name}} { {goodslist.name}}——{ {category.price}}
model
属性。{ {content}}
bind:input
处理更新。App({ onShow: (options) => { console.log("app_options", options); }});
rich-text
标签显示 HTML 内容。const request = { get(url, data = {}, options = {}) { return new Promise((resolve, reject) => { wx.request({ url: `${baseUrl}/api/${url}`, data, options, success(res) { resolve(res.data); }, fail(err) { reject(err); } }); }); }, // 其他 HTTP 方法或示例};
open-type="switchTab"
open-type="navigateTo"
, redirectTo
, reLaunch
wxml
, wxss
, json
, js
文件组成,需在 json
中声明组件属性。Component({ properties: {}, behaviors: [], data: {}, methods: {}});
map
标签,支持多种参数设置。bindcontroltap="controltap"
camera
标签,支持参数设置和事件绑定。function hello(name) { var msg = "hello " + name; console.log(msg); return msg;}module.exports.hello = hello;
module.exports = { hello(name) { console.log(`Hello ${name}!`); }, showUser(id) { console.log(`用户id:${id}`); }};
wxml
中使用。function hello(name) { var msg = "hello " + name; return msg;}module.exports.hello = hello;
template
定义模板,通过 import
和 include
引用。test
转载地址:http://ziomz.baihongyu.com/