support Message

support Message
This commit is contained in:
梁灏 2017-03-09 22:21:54 +08:00
parent a538b6751f
commit 6cadeba44f
11 changed files with 59 additions and 67 deletions

View file

@ -52,6 +52,7 @@ li + li { border-left: solid 1px #bbb; padding-left: 10px; margin-left: 10px; }
<li><router-link to="/table">Table</router-link></li>
<li><router-link to="/loading-bar">LoadingBar</router-link></li>
<li><router-link to="/modal">Modal</router-link></li>
<li><router-link to="/message">Message</router-link></li>
</ul>
</nav>
<router-view></router-view>

View file

@ -172,6 +172,10 @@ const router = new VueRouter({
{
path: '/modal',
component: require('./routers/modal.vue')
},
{
path: '/message',
component: require('./routers/message.vue')
}
]
});

View file

@ -1,44 +1,20 @@
<template>
<i-button @click="confirm">标准</i-button>
<i-button @click="custom">自定义按钮文字</i-button>
<i-button @click="async">异步关闭</i-button>
<i-button @click.native="time">显示一个10秒的提示</i-button>
</template>
<script>
export default {
methods: {
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'
});
},
async () {
this.$Modal.confirm({
title: '确认对话框标题',
content: '<p>对话框将在 2秒 后关闭</p>',
loading: true,
onOk: () => {
setTimeout(() => {
this.$Modal.remove();
this.$Message.info('异步关闭了对话框');
}, 2000);
}
time () {
this.$Message.info('我将在10秒后消失', 3, () => {
console.log(1111)
});
}
},
mounted () {
this.$Message.config({
top: 50,
duration: 3
});
}
}
</script>