我想在模板里面执行一个函数,会在本地获取一些配置参数,请问 下面的函数能在模板里面执行吗?组件那块是可以执行的,但是模板这块没有效果呢?
<template name='nav'>
<view class='nav-normal' style="height: {{navMsg.navH}}px;{{skinDiy.background}}" >
<view class='nav-back' hidden='{{navMsg.hidden}}' bindtap='goBack'></view>
<view class='nav-title'>{{navMsg.navT}}</view>
</view>
</template>
<script>
export default {
data() {
return {
skinDiy: {}
};
},
methods: {
reversedMessage: function() {
let skinDiy = wx.getStorageSync('skinDiy') && JSON.parse(wx.getStorageSync('skinDiy'));
debugger
this.setData({
skinDiy: skinDiy
})
}
}
}
</script>
去看一看wxs模块你就知道了,https://developers.weixin.qq.com/miniprogram/dev/reference/wxs/01wxs-module.html