Commit 2aa0aa6e6fc94048cb81f776d5d8bd312e957a0f
1 parent
816ff2a3
fix bug: cascader still can be opened if set to disabled
Showing
2 changed files
with
11 additions
and
0 deletions
Show diff stats
src/components/cascader/cascader.vue
@@ -129,6 +129,7 @@ | @@ -129,6 +129,7 @@ | ||
129 | this.visible = false; | 129 | this.visible = false; |
130 | }, | 130 | }, |
131 | toggleOpen () { | 131 | toggleOpen () { |
132 | + if (this.disabled) return false; | ||
132 | if (this.visible) { | 133 | if (this.visible) { |
133 | this.handleClose(); | 134 | this.handleClose(); |
134 | } else { | 135 | } else { |
test/routers/cascader.vue
@@ -3,11 +3,21 @@ | @@ -3,11 +3,21 @@ | ||
3 | <Cascader :data="data" @on-change="handleChange"> | 3 | <Cascader :data="data" @on-change="handleChange"> |
4 | <a href="javascript:void(0)">选择</a> | 4 | <a href="javascript:void(0)">选择</a> |
5 | </Cascader> | 5 | </Cascader> |
6 | + | ||
7 | + <Row> | ||
8 | + <i-col span="4"> | ||
9 | + Disabled <Switch :checked.sync="disabled"></Switch> | ||
10 | + </i-col> | ||
11 | + <i-col span="4"> | ||
12 | + <Cascader :data="data" :value.sync="value1" :disabled="disabled"></Cascader> | ||
13 | + </i-col> | ||
14 | + </Row> | ||
6 | </template> | 15 | </template> |
7 | <script> | 16 | <script> |
8 | export default { | 17 | export default { |
9 | data () { | 18 | data () { |
10 | return { | 19 | return { |
20 | + disabled: false, | ||
11 | text: '未选择', | 21 | text: '未选择', |
12 | data: [{ | 22 | data: [{ |
13 | value: 'beijing', | 23 | value: 'beijing', |