-1?picker[index].label:'中国大陆'}}{{index>-1?picker[ind..._uni-app 读取数组并展现">
赞
踩
1.创建一个.js文件
global-roamings.js
export const params = {globalRoaming:[{label:"中国",value:"86"},{label:"阿富汗",value:"93"}]}
2.页面中调用
login1.vue
{{index>-1?picker[index].label:'中国大陆'}}
{{index>-1?picker[index].value:'+86'}}
import {params} from "../components/global-roaming.js"
export default {
data() {
return {
mobile: '',
loginByPhone:'',
userInfo: {},
index: -1,
picker: [],
};
},
onShow() {
// console.log(JSON.stringify(params) )
this.picker = params.globalRoaming;
}
3.这样就完成了
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。