Commit e44ba4d4ad96ce8e3d3decb3a5afc2cf19931405
1 parent
737894de
Modal support global setting
Showing
4 changed files
with
21 additions
and
28 deletions
Show diff stats
examples/main.js
examples/routers/modal.vue
| 1 | 1 | <template> |
| 2 | 2 | <div> |
| 3 | - <p> | |
| 4 | - Name: {{ value }} | |
| 5 | - </p> | |
| 6 | - <p> | |
| 7 | - <Button @click="handleRender">Custom content</Button> | |
| 8 | - </p> | |
| 3 | + <Button type="primary" @click="modal1 = true">Display dialog box</Button> | |
| 4 | + <Modal | |
| 5 | + v-model="modal1" | |
| 6 | + title="Common Modal dialog box title" | |
| 7 | + @on-ok="ok" | |
| 8 | + @on-cancel="cancel"> | |
| 9 | + <p>Content of dialog</p> | |
| 10 | + <p>Content of dialog</p> | |
| 11 | + <p>Content of dialog</p> | |
| 12 | + </Modal> | |
| 9 | 13 | </div> |
| 10 | 14 | </template> |
| 11 | 15 | <script> |
| 12 | 16 | export default { |
| 13 | 17 | data () { |
| 14 | 18 | return { |
| 15 | - value: '' | |
| 19 | + modal1: false | |
| 16 | 20 | } |
| 17 | 21 | }, |
| 18 | 22 | methods: { |
| 19 | - handleRender () { | |
| 20 | - this.$Modal.confirm({ | |
| 21 | - title: '真不错呀', | |
| 22 | - render: (h) => { | |
| 23 | - return h('Input', { | |
| 24 | - props: { | |
| 25 | - value: this.value, | |
| 26 | - autofocus: true, | |
| 27 | - placeholder: 'Please enter your name...' | |
| 28 | - }, | |
| 29 | - on: { | |
| 30 | - input: (val) => { | |
| 31 | - this.value = val; | |
| 32 | - } | |
| 33 | - } | |
| 34 | - }) | |
| 35 | - } | |
| 36 | - }) | |
| 23 | + ok () { | |
| 24 | + this.$Message.info('Clicked ok'); | |
| 25 | + }, | |
| 26 | + cancel () { | |
| 27 | + this.$Message.info('Clicked cancel'); | |
| 37 | 28 | } |
| 38 | 29 | } |
| 39 | 30 | } | ... | ... |
src/components/modal/modal.vue
src/index.js
| ... | ... | @@ -166,7 +166,7 @@ const install = function(Vue, opts = {}) { |
| 166 | 166 | |
| 167 | 167 | Vue.prototype.$IVIEW = { |
| 168 | 168 | size: opts.size || '', |
| 169 | - transfer: opts.transfer || '' | |
| 169 | + transfer: 'transfer' in opts ? opts.transfer : '' | |
| 170 | 170 | }; |
| 171 | 171 | |
| 172 | 172 | Vue.prototype.$Loading = LoadingBar; | ... | ... |