kui-vue
Version:
A lightweight desktop UI component library suitable for Vue.js 2.
44 lines (41 loc) • 948 B
Markdown
<cn>
### 自定义时长
可以自定义配置,其中 `duration` 来控制自动关闭时长,默认 `3s` , `closable` 显示关闭按钮
</cn>
```vue
<template>
<Space vertical>
<Button @click="config">10秒后关闭</Button>
<Button @click="config2" type="primary">5秒后关闭</Button>
<Button @click="config3" type="primary">手动关闭</Button>
<Button @click="destroy" type="primary">destroy</Button>
</Space>
</template>
<script setup>
import { message } from "kui-vue";
const config = () => {
message.success("10秒后关闭", 10);
};
const config2 = () => {
message.show({
type: "info",
duration: 5,
content: "5秒后关闭",
});
};
const config3 = () => {
message.show({
type: "info",
duration: 0,
closable: true,
content: "手动关闭",
onClose: () => {
message.success("我是回调");
},
});
};
const destroy = () => {
message.destroy();
};
</script>
```