Commit a861963bd8230b4d225e6b852381b9a7ebaaa69b
Committed by
GitHub
Merge pull request #242 from rijn/241
added scrolling property to toggle CSS for creating or hiding scrollbars
Showing
2 changed files
with
20 additions
and
2 deletions
Show diff stats
src/components/modal/modal.vue
| ... | ... | @@ -76,6 +76,10 @@ |
| 76 | 76 | footerHide: { |
| 77 | 77 | type: Boolean, |
| 78 | 78 | default: false |
| 79 | + }, | |
| 80 | + scrollable: { | |
| 81 | + type: Boolean, | |
| 82 | + default: false | |
| 79 | 83 | } |
| 80 | 84 | }, |
| 81 | 85 | data () { |
| ... | ... | @@ -204,13 +208,22 @@ |
| 204 | 208 | } else { |
| 205 | 209 | if (this.timer) clearTimeout(this.timer); |
| 206 | 210 | this.wrapShow = true; |
| 207 | - this.addScrollEffect(); | |
| 211 | + if (!this.scrollable) { | |
| 212 | + this.addScrollEffect(); | |
| 213 | + } | |
| 208 | 214 | } |
| 209 | 215 | }, |
| 210 | 216 | loading (val) { |
| 211 | 217 | if (!val) { |
| 212 | 218 | this.buttonLoading = false; |
| 213 | 219 | } |
| 220 | + }, | |
| 221 | + scrollable (val) { | |
| 222 | + if (!val) { | |
| 223 | + this.addScrollEffect(); | |
| 224 | + } else { | |
| 225 | + this.removeScrollEffect(); | |
| 226 | + } | |
| 214 | 227 | } |
| 215 | 228 | } |
| 216 | 229 | }; | ... | ... |
test/routers/more.vue
| ... | ... | @@ -5,21 +5,26 @@ |
| 5 | 5 | </style> |
| 6 | 6 | <template> |
| 7 | 7 | <i-button type="primary" @click="modal1 = true">显示对话框</i-button> |
| 8 | + <i-button @click="scrollable = !scrollable">Toggle scrollable</i-button> | |
| 9 | + scrollable:{{scrollable}} | |
| 8 | 10 | <Modal |
| 9 | 11 | :visible.sync="modal1" |
| 10 | 12 | title="普通的Modal对话框标题" |
| 13 | + :scrollable="scrollable" | |
| 11 | 14 | @on-ok="ok" |
| 12 | 15 | @on-cancel="cancel"> |
| 13 | 16 | <p>对话框内容</p> |
| 14 | 17 | <p>对话框内容</p> |
| 15 | 18 | <p>对话框内容</p> |
| 19 | + <i-button @click="scrollable = !scrollable">Toggle scrollable</i-button> | |
| 16 | 20 | </Modal> |
| 17 | 21 | </template> |
| 18 | 22 | <script> |
| 19 | 23 | export default { |
| 20 | 24 | data () { |
| 21 | 25 | return { |
| 22 | - modal1: false | |
| 26 | + modal1: false, | |
| 27 | + scrollable: false | |
| 23 | 28 | } |
| 24 | 29 | }, |
| 25 | 30 | methods: { | ... | ... |