提交 99106b1c 编写于 作者: 郭胜强

解决mpvue-picker组件第一次不显示的问题。

上级 6e6dddeb
......@@ -33,32 +33,38 @@ export default {
pickerValue: [0, 0, 0],
provinceDataList: [],
cityDataList: [],
areaDataList: []
areaDataList: [],
/* 是否显示控件 */
showPicker: false,
};
},
created() {
this.handPickValueDefault(); // 对 pickerValueDefault 做兼容处理
this.provinceDataList = provinceData;
this.cityDataList = cityData[this.pickerValueDefault[0]];
this.areaDataList =
areaData[this.pickerValueDefault[0]][this.pickerValueDefault[1]];
this.pickerValue = this.pickerValueDefault;
this.init()
},
props: {
/* 是否显示控件 */
showPicker: {
type: Boolean,
default: false
},
/* 默认值 */
pickerValueDefault: {
type: Array,
default: [0, 0, 0]
default(){
return [0, 0, 0]
}
},
/* 主题色 */
themeColor: String
},
watch:{
pickerValueDefault(){
this.init();
}
},
methods: {
init() {
this.handPickValueDefault(); // 对 pickerValueDefault 做兼容处理
this.provinceDataList = provinceData;
this.cityDataList = cityData[this.pickerValueDefault[0]];
this.areaDataList = areaData[this.pickerValueDefault[0]][this.pickerValueDefault[1]];
this.pickerValue = this.pickerValueDefault;
},
show() {
setTimeout(() => {
this.showPicker = true;
......
......@@ -78,7 +78,9 @@
pickerValueMulTwoTwo: [],
pickerValueMulThreeOne: [],
pickerValueMulThreeTwo: [],
pickerValueMulThreeThree: []
pickerValueMulThreeThree: [],
/* 是否显示控件 */
showPicker: false,
};
},
props: {
......@@ -87,20 +89,19 @@
type: String,
default: 'selector'
},
/* 是否显示控件 */
showPicker: {
type: Boolean,
default: false
},
/* picker 数值 */
pickerValueArray: {
type: Array,
default: []
default(){
return []
}
},
/* 默认值 */
pickerValueDefault: {
type: Array,
default: []
default(){
return []
}
},
/* 几级联动 */
deepLength: {
......@@ -116,6 +117,9 @@
},
mode(oldVal, newVal) {
this.modeChange = true;
},
pickerValueArray(val){
this.initPicker(val);
}
},
methods: {
......
......@@ -34,7 +34,6 @@
data() {
return {
title : "mvpue-picker 使用示例",
pickerValueDefault: [0, 0],
pickerSingleArray: [{
label: '中国',
value: 1
......@@ -58,7 +57,8 @@
pickerText: '',
mode: '',
deepLength: 1,
pickerValueDefault: [0]
pickerValueDefault: [0],
pickerValueArray:[]
};
},
methods: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册