写了一个本地数据库在详情页里怎么调用啊,为哦是吗AppData里明明已经有了就是显示不出来?大佬们
发布于 6 年前 作者 wliang 10365 次浏览 来自 问答

Page({

data: {

ellipsis: false,

ellipsis1: false,

},

onLoad: function (options) {

const postsData = require(’…/localData/localData.js’);

var id = options.id;

var adapterSource = postsData.adapterSource[id];

this.setData({

adapterSource: adapterSource

})

},

f1: function (event) {

wx.navigateTo({

url: ‘/pages/list/list’

})

},

tel: function () {

wx.makePhoneCall({

phoneNumber: ‘17623030926’,

})

},

data: {

},

wz: function (event) {

console.log(adapterSource);

wx.getLocation({

type: ‘gcj02’,

success: function (res) {

var latitude = res.latitude

var longitude = res.longitude

wx.openLocation({

latitude: latitude,

longitude: longitude,

scale: 28

})

}

})

},

ellipsis: function () {

var value = !this.data.ellipsis;

this.setData({

ellipsis: value

})

},

ellipsis1: function () {

var value = !this.data.ellipsis1;

this.setData({

ellipsis1: value

})

},

})

这里是AppData里显示的

4 回复

大哥们又有新问题了,我在另一台电脑上写,又不行了,可以打印出来我要的值但是不能用

wxml的代码呢?写个可复现问题的代码片段吧

https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

你这 是不是有两个 data? page下面一个 WZ上面一个

wz哪使用data里的值了?

回到顶部