feature-options.js 529 Bytes
/**
 * 选项组件
 *
 * @author: Aiden Xu<aiden.xu@yoho.cn>
 * @date: 2016/07/20
 */
module.exports = {
    props: {
        options: Array,
        name: String,
        selection: null
    },
    data() {
        return {
            value: ''
        };
    },
    watch: {
        selection() {
            this.value = this.selection;
        }
    },
    methods: {
        selectOption: function(opt) {
            this.value = opt;
            this.$parent.$emit(`feature:${this.name}.select`, opt);
        }
    }
};