ThinkSSL🔒 一键申购 5分钟快速签发 30天无理由退款 购买更放心 广告
[toc] ## 组件中无法加载到全局样式 在组件的js中添加以下代码 ``` options: { addGlobalClass: true } ``` ## bindtap传参 ``` ## wxml <list wx:for="{{list}}" wx:for-item="item" data-gid="1" bindtap="detail" ></list> ## js detail: function(e) { console.log(e.currentTarget.dataset.gid) } ``` ## 组件监听properties改变事件 ``` properties: { date: { type: null, value: null, observer: function () { // 值改变时间 } } } ``` ## 设置小程序更新 ``` setUpdate: function() { const updateManager = wx.getUpdateManager() updateManager.onCheckForUpdate(function (res) { // 请求完新版本信息的回调 console.log(res.hasUpdate) }) updateManager.onUpdateReady(function () { wx.showModal({ title: '更新提示', content: '新版本已经准备好,是否重启应用?', success: function (res) { if (res.confirm) { // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 updateManager.applyUpdate() } } }) }) updateManager.onUpdateFailed(function () { // 新版本下载失败 }) } ``` ## 样式处理 1. 文字加下划线`text-decoration: underline;` 2. 文字加删除线`text-decoration:line-through;`