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

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

上级 39db8747
<template>
<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>
<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'">
......@@ -43,7 +43,7 @@ export default class AppSelect extends Vue {
* @memberof AppSelect
*/
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})
if (isIncluded) {
return this.value;
......@@ -51,10 +51,6 @@ export default class AppSelect extends Vue {
}
return "";
}
set curValue(value:any){
this.$emit("change", value);
}
/**
* change事件
......@@ -63,19 +59,21 @@ export default class AppSelect extends Vue {
*/
public change(value: any) {
let devalue:any = value.detail.value;
for(let key in this.options){
if (this.options[key].isValueNumber) {
devalue = +devalue;
}
}
if (Object.is(this.codeListType, 'DYNAMIC')) {
for(let key in this.options){
if (typeof this.options[key].id == 'number') {
if (devalue !== '') {
for(let key in this.options){
if (this.options[key].isValueNumber) {
devalue = +devalue;
}
}
}
}
if (Object.is(this.codeListType, 'DYNAMIC')) {
for(let key in this.options){
if (typeof this.options[key].id == 'number') {
devalue = +devalue;
}
}
}
}
this.curValue = devalue;
this.$emit("change", devalue);
}
/**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册