From 32b40ec0722e3b0df055b0a85f7d68a14720d3fc Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期一, 03 一月 2022 15:28:23 +0800 Subject: [PATCH] Update:[multiSelectBtn] add maxOption setting --- PAMapp/components/multiSelectBtn.vue | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/PAMapp/components/multiSelectBtn.vue b/PAMapp/components/multiSelectBtn.vue index d7d5fe4..0abc66e 100644 --- a/PAMapp/components/multiSelectBtn.vue +++ b/PAMapp/components/multiSelectBtn.vue @@ -25,7 +25,7 @@ </template> <script lang="ts"> - import { Vue, Component, Prop, PropSync} from 'vue-property-decorator'; + import { Vue, Component, Prop, PropSync, Watch} from 'vue-property-decorator'; import { OptionBtnDto } from '~/shared/models/optionBtnDto.model'; @Component @@ -46,6 +46,17 @@ @Prop({type:String,default:''}) nameOfOtherOption!:string; + @Prop() + maxLength? : number; + + @Watch('syncMutiSelect') + onMutiSelectChange(): void { + if (!this.maxLength) return; + if (this.syncMutiSelect.length > this.maxLength) { + this.syncMutiSelect.shift(); + } + } + isSelectOtherOption=false; isSelectAll=false; -- Gitblit v1.8.0