iview/examples/routers/modal.vue

68 lines
2.2 KiB
Vue
Raw Normal View History

2017-03-09 18:31:47 +08:00
<template>
<div>
2017-06-01 12:32:00 +08:00
<Button @click="confirm">标准</Button>
<Button @click="custom">自定义按钮文字</Button>
<Button @click="async">异步关闭</Button>
2017-06-01 19:00:37 +08:00
<Button type="primary" @click="modal1 = true">显示对话框</Button>
<Modal
v-model="modal1"
title="普通的Modal对话框标题"
@on-ok="ok"
@on-cancel="cancel">
<p>对话框内容</p>
<p>对话框内容</p>
<p>对话框内容</p>
</Modal>
2017-03-09 18:31:47 +08:00
</div>
</template>
<script>
export default {
2017-06-01 19:00:37 +08:00
data () {
return {
modal1: false
}
},
2017-03-09 18:31:47 +08:00
methods: {
2017-06-01 19:00:37 +08:00
ok () {
this.$Message.info('点击了确定');
},
cancel () {
this.$Message.info('点击了取消');
},
2017-06-01 12:32:00 +08:00
confirm () {
this.$Modal.confirm({
title: '确认对话框标题',
content: '<p>一些对话框内容</p><p>一些对话框内容</p>',
onOk: () => {
this.$Message.info('点击了确定');
},
onCancel: () => {
this.$Message.info('点击了取消');
}
});
},
custom () {
this.$Modal.confirm({
title: '确认对话框标题',
content: '<p>一些对话框内容</p><p>一些对话框内容</p>',
okText: 'OK',
cancelText: 'Cancel'
});
},
2017-06-01 12:32:00 +08:00
async () {
this.$Modal.confirm({
title: '确认对话框标题',
content: '<p>对话框将在 2秒 后关闭</p>',
loading: true,
onOk: () => {
setTimeout(() => {
this.$Modal.remove();
this.$Message.info('异步关闭了对话框');
}, 2000);
}
});
2017-03-09 18:31:47 +08:00
}
}
}
</script>