/
githubmirror
/
element
Обзор
Документация
Войти
/
githubmirror
/
element
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/select/src/option-group.vue
60 строк
1 KB
Leopoldthecoder
Select: fix divider and focus issue
12 ноя 2017, 09:27
12 ноя 2017, 09:27
1833db2
Код
Авторство
О чём код?
<template> <ul class="el-select-group__wrap" v-show="visible"> <li class="el-select-group__title">{{ label }}</li> <li> <ul class="el-select-group"> <slot></slot> </ul> </li> </ul> </template> <script type="text/babel"> import Emitter from 'element-ui/src/mixins/emitter'; export default { mixins: [Emitter], name: 'ElOptionGroup', componentName: 'ElOptionGroup', props: { label: String, disabled: { type: Boolean, default: false } }, data() { return { visible: true }; }, watch: { disabled(val) { this.broadcast('ElOption', 'handleGroupDisabled', val); } }, methods: { queryChange() { this.visible = this.$children && Array.isArray(this.$children) && this.$children.some(option => option.visible === true); } }, created() { this.$on('queryChange', this.queryChange); }, mounted() { if (this.disabled) { this.broadcast('ElOption', 'handleGroupDisabled', this.disabled); } } }; </script>