setData问题:
转换器某个版本的setData会有问题(我用的就是,
可以在main.js里面重写setData函数
ps:可以把每个页面转换后的setData函数统一重命名一下。
Vue.mixin({ methods: { setData(obj) { let that = this; let keys = []; let val, data; Object.keys(obj).forEach(function (key) { keys = key.split('.'); val = obj[key]; data = that.$data; keys.forEach(function (key2, index) { if (index + 1 == keys.length) { that.$set(data, key2, val); } else { if (!data[key2]) { that.$set(data, key2, {}); } } data = data[key2]; }) }); } } });
转换工具 https://github.com/zhangdaren/miniprogram-to-uniapp