提交 d04f4840 编写于 作者: zhujiamin's avatar zhujiamin

下拉选择(单选编辑器)逻辑调整 by:昊楠

上级 39db8747
<template> <template>
<div class="app-mobile-select" data-tap-disabled="true"> <div class="app-mobile-select" data-tap-disabled="true">
<div class="cancel-icon" v-if="curValue"><ion-icon name="close-circle-outline" @click="clear"></ion-icon></div> <div class="cancel-icon" v-if="curValue === null || curValue === ''"><ion-icon name="close-circle-outline" @click="clear"></ion-icon></div>
<div v-if="curValue== null || curValue==''" class="ion-select-icon"></div> <div v-if="curValue== null || curValue==''" class="ion-select-icon"></div>
<ion-select :value="curValue" :disabled="disabled ? disabled : false" @ionChange="change" interface="action-sheet" @click="load" :cancel-text="$t('app.button.cancel')"> <ion-select :value="curValue" :disabled="disabled ? disabled : false" @ionChange="change" interface="action-sheet" @click="load" :cancel-text="$t('app.button.cancel')">
<template v-if="codeListType == 'DYNAMIC'"> <template v-if="codeListType == 'DYNAMIC'">
...@@ -43,7 +43,7 @@ export default class AppSelect extends Vue { ...@@ -43,7 +43,7 @@ export default class AppSelect extends Vue {
* @memberof AppSelect * @memberof AppSelect
*/ */
get curValue() { get curValue() {
if (this.value && this.options.length > 0) { if (this.options.length > 0 && this.value !== null && this.value !== "") {
let isIncluded = this.options.some((option:any)=>{return option.value === this.value}) let isIncluded = this.options.some((option:any)=>{return option.value === this.value})
if (isIncluded) { if (isIncluded) {
return this.value; return this.value;
...@@ -52,10 +52,6 @@ export default class AppSelect extends Vue { ...@@ -52,10 +52,6 @@ export default class AppSelect extends Vue {
return ""; return "";
} }
set curValue(value:any){
this.$emit("change", value);
}
/** /**
* change事件 * change事件
* *
...@@ -63,6 +59,7 @@ export default class AppSelect extends Vue { ...@@ -63,6 +59,7 @@ export default class AppSelect extends Vue {
*/ */
public change(value: any) { public change(value: any) {
let devalue:any = value.detail.value; let devalue:any = value.detail.value;
if (devalue !== '') {
for(let key in this.options){ for(let key in this.options){
if (this.options[key].isValueNumber) { if (this.options[key].isValueNumber) {
devalue = +devalue; devalue = +devalue;
...@@ -75,7 +72,8 @@ export default class AppSelect extends Vue { ...@@ -75,7 +72,8 @@ export default class AppSelect extends Vue {
} }
} }
} }
this.curValue = devalue; }
this.$emit("change", devalue);
} }
/** /**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册