保誠-保戶業務員媒合平台
wayne
2022-02-17 a3716f72066d25d745f4d5103ff23a553c3e102b
PAMapp/components/singleSelectBtn.vue
@@ -20,25 +20,22 @@
<script lang="ts">
  import { Component, Prop, PropSync, Vue } from "nuxt-property-decorator";
  import { OptionBtnDto } from "~/shared/models/optionBtnDto.model";
  import * as _ from 'lodash';
  @Component
  export default class SingleSelectBtn extends Vue {
    @PropSync('singleSelected', { default: '' }) syncSingleSelected!: string | number;
    @Prop({ type:Array , default:()=>[] }) options!:OptionBtnDto[];
    // 主要解決按鈕點擊兩次能回到,未點選的狀態
    patchValue(value: string): void {
    @PropSync('singleSelected', { default: '' })
    syncSingleSelected!: string | number;
    @Prop({ type:Array , default:()=>[] })
    options!:OptionBtnDto[];
    //////////////////////////////////////////////////////////////////////
    patchValue(value: string | number): void {
      // 主要解決按鈕點擊兩次能回到,未點選的狀態
      this.syncSingleSelected = _.isEqual(this.syncSingleSelected, value) ? "" : value;
    }
  }
  export interface OptionBtnDto {
    title: string,
    subTitle?: string,
    label: string | number,
  }
</script>
<style lang="scss"
  scoped>
</style>