保誠-保戶業務員媒合平台
HelenHuang
2022-05-20 13d66456556a5c0a8f1ed519c01e7bd2f31d2160
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { createDecorator } from 'vue-class-component';
/**
 * decorator of a ref prop
 * @param refKey the ref key defined in template
 */
export function Ref(refKey) {
    return createDecorator(function (options, key) {
        options.computed = options.computed || {};
        options.computed[key] = {
            cache: false,
            get: function () {
                return this.$refs[refKey || key];
            },
        };
    });
}