在Uniapp中采用Vue开发,支持像继承一样的东西可以全局定义一套公用的方法和变量供某个page对象使用
需要在main.js文件中定义如下结构
Vue.mixin({
//你的变量
data() {
return data
},
methods: {
//你的方法列表
locationmap() {
if (this.g.openLocation == true) {
this.g.openLocation = false;
uni.openLocation({
longitude: this.g.open_longitude,
latitude: this.g.open_latitude,
name: this.g.open_name,
address: this.g.open_address,
})
}
}
}
});