Blame view

src/components/select/functional-options.vue 849 Bytes
c9b86944   Sergio Crisostomo   Refactor Select!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  
  <script>
      const returnArrayFn = () => [];
  
      export default {
          props: {
              options: {
                  type: Array,
                  default: returnArrayFn
              },
              slotOptions: {
                  type: Array,
                  default: returnArrayFn
              },
              slotUpdateHook: {
                  type: Function,
                  default: () => {}
              },
          },
          functional: true,
20719945   Aresn   Revert "Fix select"
21
22
23
24
25
          render(h, {props, parent}){
              // to detect changes in the $slot children/options we do this hack
              // so we can trigger the parents computed properties and have everything reactive
              // although $slot.default is not
              if (props.slotOptions !== parent.$slots.default) props.slotUpdateHook();
c9b86944   Sergio Crisostomo   Refactor Select!
26
27
28
29
              return props.options;
          }
      };
  </script>