Accepting incoming values : fixed

This commit is contained in:
Vion 2022-01-20 23:53:53 +08:00
parent 56ae1ef035
commit 55e23ac305

View File

@ -56,27 +56,14 @@ export default {
},
methods:{
initAddress(){
this.show=true;
//Initilizing
//mobile
let self=this;
// defaultValues : array[{id:"_ID_IN_columns_of_province",name:"_NAME_IN_columns"},{id:"_ID_IN_columns_of_city",name:"_NAME_IN_columns"},{id:"_ID_IN_columns_of_area",name:"_NAME_IN_columns"}]
let defaultValues = [{id:this.columns[0].values[0].id, name:this.columns[0].values[0].name},{id:this.columns[1].values[0].id, name:this.columns[1].values[0].name},{id:this.columns[2].values[0].id, name:this.columns[2].values[0].name}];
if(this.defaultValues)
defaultValues=this.defaultValues;
this.$children.forEach(function(vueComponent){
if(vueComponent._name=="<VanPicker>")
{
self.onChange(vueComponent,defaultValues); //Important
}
});
//mobile end
//PC
this.curDisplayingColIndex=0;
this.switchTab(this.curDisplayingColIndex);
//PC end
if(this.defaultValues && this.defaultValues.length>0)
{
defaultValues = this.defaultValues;
this.onConfirm(defaultValues);
}
//Initilizing end
},
pickValue(pickId,pickName){
@ -160,7 +147,7 @@ export default {
return false;
for(var i in haystack){
if(haystack[i].id==needle.id){
return true;
return i;
}
}
return false;
@ -245,6 +232,33 @@ export default {
},
popAddress() {
this.show=true;
let _self=this;
//mobile
//const picker = this.selectComponent('.ts-area-picker-mobile-component');
this.defaultValues.forEach(function(ele,index){
let tmpPointer=parseInt(_self.inArray(ele,_self.columns[index].values));
if(tmpPointer)
{
_self.columns[index].defaultIndex = tmpPointer;
}
});
// setTimeout(function(){
// //debugger;
// _self.$children.forEach(function(vueComponent){
// if(vueComponent._name=="<VanPicker>")
// {
// _self.onChange(vueComponent,_self.returnValueArr); //Important
// }
// });
// },500);
//mobile end
//PC
this.curDisplayingColIndex=0;
this.switchTab(this.curDisplayingColIndex);
//PC end
},
pcHideAddress() {
this.onConfirm(this.returnValueArr);
@ -312,13 +326,13 @@ export default {
</script>
<style lang="less" scoped>
.ts-area-picker-container{display:inline-block;}
.ts-area-picker-container{display:inline-block;position:relative;}
.ts-area-picker-value-displayer{
}
.ts-area-picker-tmp-value{
border-bottom:1px solid #D7D7D7;
padding:0 2.5rem;
padding:0;
box-sizing: border-box;
position:relative;
ul{
@ -332,6 +346,7 @@ export default {
padding: 1.25rem 0;
margin-right:.75rem;
cursor: pointer;
text-align: center;
&.active{
color:#E2001A;
border-bottom:4px solid #E2001A;
@ -456,11 +471,15 @@ export default {
width:40rem;
}
.ts-area-picker-desktop{
position:absolute;
top:0;
left:0;
display:block;
width:100%;
height:19.25rem;
border:1px solid #808285;
overflow:hidden;
background:#fff;
}
}
@keyframes flash-error