From 9bdb95c9e34cef640534e5e5a1e2225a80442000 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期四, 09 六月 2022 15:48:15 +0800
Subject: [PATCH] TODO#139894 [ footer -最下方說明與保經代合作 ] 文案修改

---
 PAMapp/components/multiSelectBtn.vue |   64 ++++++++++++++++++++------------
 1 files changed, 40 insertions(+), 24 deletions(-)

diff --git a/PAMapp/components/multiSelectBtn.vue b/PAMapp/components/multiSelectBtn.vue
index aa1302a..707a96f 100644
--- a/PAMapp/components/multiSelectBtn.vue
+++ b/PAMapp/components/multiSelectBtn.vue
@@ -5,7 +5,7 @@
         v-for="(option, index) in options"
         :key="index"
         :label="option.label">
-          {{option.title}}
+          {{ option.title }}
         </el-checkbox>
       <template v-if="nameOfSelectAll">
         <button class="pam-selectAll-btn cursor--pointer fix-chrome-click--issue" :class="{'selected':isSelectAll}" :model="isSelectAll" @click="selectAll">
@@ -14,7 +14,7 @@
       </template>
       <template v-if="nameOfOtherOption">
         <button class="pam-selectAll-btn cursor--pointer fix-chrome-click--issue" :class="{'selected':isSelectOtherOption}" :model="isSelectOtherOption" @click="selectOther">
-         {{nameOfOtherOption}}
+         {{ nameOfOtherOption }}
         </button>
         <div>
           <input class="pam-muti-select-other cursor--pointer " v-if="isSelectOtherOption" v-model="syncOtherSelect" placeholder="隢撓�,���20摮�">
@@ -25,11 +25,12 @@
 </template>
 
 <script lang="ts">
-  import { Vue, Component, Prop, PropSync} from 'vue-property-decorator';
-  import { OptionBtnDto } from './singleSelectBtn.vue';
+  import { Vue, Component, Prop, PropSync, Watch} from 'vue-property-decorator';
+import { OptionBtnDto } from '~/shared/models/optionBtnDto.model';
 
   @Component
   export default class MultiSelectBtn extends Vue {
+
     @PropSync('mutiSelect',{type:Array,default:()=>[]})
     syncMutiSelect!:string[];
 
@@ -45,23 +46,38 @@
     @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;
 
     //////////////////////////////////////////////////////////////////////
+
     updated() {
       this.isSelectAll = this.syncMutiSelect.length === this.options.length;
     }
 
     //////////////////////////////////////////////////////////////////////
-    selectAll():void{
+
+    selectAll():void {
       this.isSelectAll= !this.isSelectAll;
       this.syncMutiSelect = this.isSelectAll ? this.optionsFormat(this.options):[];
     }
-    optionsFormat(optios:OptionBtnDto[]):string[]{
-      return optios.map(o=>o.title);
+
+    optionsFormat(options:OptionBtnDto[]): string[] {
+      return options.map((option)=> option.title );
     }
-    selectOther():void{
+
+    selectOther(): void {
       this.isSelectOtherOption = !this.isSelectOtherOption;
       if(!this.isSelectOtherOption){
         this.syncOtherSelect = '';
@@ -72,26 +88,26 @@
 
 <style lang="scss" scoped>
   .pam-selectAll-btn{
-    padding: 6px 20px;
-    border: 1px $LIGHT_GREY solid;
+    padding         : 10px 20px;
+    border          : 1px $LIGHT_GREY solid;
     background-color: $PRIMARY_WHITE;
-    border-radius: 30px;
-    color: $PRIMARY_BLACK;
-    font-size: 20px;
-    margin-right: 10px;
-    margin-bottom: 10px;
+    border-radius   : 30px;
+    color           : $PRIMARY_BLACK;
+    font-size       : 20px;
+    margin-right    : 10px;
+    margin-bottom   : 10px;
     &.selected{
-      background-color:$CORAL;
-      color: $PRIMARY_WHITE;
+      background-color: $CORAL;
+      color           : $PRIMARY_WHITE;
     }
   }
   .pam-muti-select-other {
-    height: 50px;
-    padding: 5px;
-    -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-    -moz-box-sizing: border-box;    /* Firefox, other Gecko */
-    box-sizing: border-box;
-    width: 316px;
-    border: 1px solid #CCCCCC;
+    height            : 50px;
+    padding           : 5px;
+    -webkit-box-sizing: border-box;         /* Safari/Chrome, other WebKit */
+    -moz-box-sizing   : border-box;         /* Firefox, other Gecko */
+    box-sizing        : border-box;
+    width             : 316px;
+    border            : 1px solid #CCCCCC;
   }
 </style>

--
Gitblit v1.8.0