diff --git a/examples/routers/modal.vue b/examples/routers/modal.vue index 680b527..0ff08dd 100644 --- a/examples/routers/modal.vue +++ b/examples/routers/modal.vue @@ -1,18 +1,67 @@ @@ -20,8 +69,25 @@ export default { data () { return { + formItem: { + input: '', + select: '', + radio: 'male', + checkbox: [], + switch: true, + date: '', + time: '', + slider: [20, 50], + textarea: '' + }, modal1: false, - val: '' + model13: '', + loading1: false, + options1: [], + model14: [], + loading2: false, + options2: [], + list: ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New hampshire', 'New jersey', 'New mexico', 'New york', 'North carolina', 'North dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode island', 'South carolina', 'South dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West virginia', 'Wisconsin', 'Wyoming'] } }, methods: { @@ -31,51 +97,22 @@ cancel () { this.$Message.info('点击了取消'); }, - confirm () { - this.$Modal.confirm({ - title: '确认对话框标题', - content: '

一些对话框内容

一些对话框内容

', - render: (h) => { - return h('Input', { - props: { - value: this.val, - autofocus: true - }, - on: { - input: (val) => { - this.val = val; - } - } - }, '一个按钮') - }, - onOk: () => { - this.$Message.info('点击了确定'); - }, - onCancel: () => { - this.$Message.info('点击了取消'); - } - }); - }, - custom () { - this.$Modal.confirm({ - title: '确认对话框标题', - content: '

一些对话框内容

一些对话框内容

', - okText: 'OK', - cancelText: 'Cancel' - }); - }, - async () { - this.$Modal.confirm({ - title: '确认对话框标题', - content: '

对话框将在 2秒 后关闭

', - loading: true, - onOk: () => { - setTimeout(() => { - this.$Modal.remove(); - this.$Message.info('异步关闭了对话框'); - }, 2000); - } - }); + remoteMethod1 (query) { + if (query !== '') { + this.loading1 = true; + setTimeout(() => { + this.loading1 = false; + const list = this.list.map(item => { + return { + value: item, + label: item + }; + }); + this.options1 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1); + }, 200); + } else { + this.options1 = []; + } } } } diff --git a/src/components/modal/modal.vue b/src/components/modal/modal.vue index 17440cb..037a9f0 100644 --- a/src/components/modal/modal.vue +++ b/src/components/modal/modal.vue @@ -121,8 +121,9 @@ mainStyles () { let style = {}; + const width = parseInt(this.width); const styleWidth = { - width: `${this.width}px` + width: width <= 100 ? `${width}%` : `${width}px` }; const customStyle = this.styles ? this.styles : {}; -- libgit2 0.21.4