提交 11e996fe 编写于 作者: Neuromancer255's avatar Neuromancer255

下拉列表(单选)调整 --fix1

上级 004341c1
<template> <template>
<div v-if="overload" 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"><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')">
...@@ -43,7 +43,16 @@ export default class AppSelect extends Vue { ...@@ -43,7 +43,16 @@ export default class AppSelect extends Vue {
* @memberof AppSelect * @memberof AppSelect
*/ */
get curValue(){ get curValue(){
return this.value;
if(this.options.length > 0){
let index = this.options.indexOf(this.value)
if (index !== -1) {
return this.value;
} else {
return ""
}
}
return ""
} }
set curValue(value:any){ set curValue(value:any){
...@@ -162,14 +171,6 @@ export default class AppSelect extends Vue { ...@@ -162,14 +171,6 @@ export default class AppSelect extends Vue {
*/ */
public isCached: boolean = false; public isCached: boolean = false;
/**
* 加载完成
*
* @type {*}
* @memberof AppSelect
*/
public overload: boolean = false;
/** /**
* 监听表单数据 * 监听表单数据
* *
...@@ -189,7 +190,6 @@ export default class AppSelect extends Vue { ...@@ -189,7 +190,6 @@ export default class AppSelect extends Vue {
*/ */
public mounted() { public mounted() {
if (Object.is(this.codeListType, "STATIC")) { if (Object.is(this.codeListType, "STATIC")) {
this.overload = true;
this.options = this.$store.getters.getCodeListItems(this.tag); this.options = this.$store.getters.getCodeListItems(this.tag);
} else { } else {
if (this.curValue) { if (this.curValue) {
...@@ -217,13 +217,11 @@ export default class AppSelect extends Vue { ...@@ -217,13 +217,11 @@ export default class AppSelect extends Vue {
} }
let response: any = await this.codeListService.getItems(this.tag, param.context, param.param); let response: any = await this.codeListService.getItems(this.tag, param.context, param.param);
if (response) { if (response) {
this.overload = true;
this.options = response this.options = response
if (this.isCache) { if (this.isCache) {
this.isCached = true; this.isCached = true;
} }
} else { } else {
this.overload = true;
this.options = []; this.options = [];
} }
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册