add Dropdown component
add Dropdown component
This commit is contained in:
parent
0f4ccf4486
commit
ab8aaf958a
13 changed files with 235 additions and 4 deletions
50
src/components/dropdown/dropdown-item.vue
Normal file
50
src/components/dropdown/dropdown-item.vue
Normal file
|
@ -0,0 +1,50 @@
|
|||
<template>
|
||||
<li :class="classes" @click="handleClick"><slot></slot></li>
|
||||
</template>
|
||||
<script>
|
||||
const prefixCls = 'ivu-dropdown-item';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
key: {
|
||||
type: [String, Number]
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
selected: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
divided: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
classes () {
|
||||
return [
|
||||
`${prefixCls}`,
|
||||
{
|
||||
[`${prefixCls}-disabled`]: this.disabled,
|
||||
[`${prefixCls}-selected`]: this.selected,
|
||||
[`${prefixCls}-divided`]: this.divided
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClick () {
|
||||
if (this.disabled) {
|
||||
this.$nextTick(() => {
|
||||
this.$parent.$parent.visible = true;
|
||||
});
|
||||
} else {
|
||||
this.$parent.$parent.visible = false;
|
||||
}
|
||||
this.$parent.$parent.$emit('on-click', this.key);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue