基本使用
Alert({ title: "vue3.0", content: "当前版本 vue3.0.0-beta.1", btns: [ { text: "确定", handle: () => { console.log("你点击了确定"); } }, { text: "取消", handle: () => { console.log("你点击了取消"); } } ] });
![a28414f7501710406580defb584af35c.png](https://i-blog.csdnimg.cn/blog_migrate/2db78507dec10786f72b70a8ff959f2c.jpeg)
不带按钮
const Alert2 = () => { Alert({ title: "vue3.0", content: "当前版本 vue3.0.0-beta.1", }); };
![0c39f218d56ed6d1286a6d10e431407c.png](https://i-blog.csdnimg.cn/blog_migrate/5881fcd99dce7a245fc89f8c8c8f948b.jpeg)
无标题
const Alert3 = () => { Alert({ content: "当前版本 vue3.0.0-beta.1", btns: [ { text: "确定", }, { text: "取消", } ] }); };
![d23917fc01cba6ea55d931112296911b.png](https://i-blog.csdnimg.cn/blog_migrate/a388bb1333cf68c09235172fcfdf34b8.jpeg)
无内容
const Alert4 = () => { Alert({ title: "vue3.0", btns: [ { text: "确定", }, { text: "取消", } ] }); };
![efdf037f5e3c642aaba6a34b2af58e67.png](https://i-blog.csdnimg.cn/blog_migrate/f80431d92a9f8c0104ccaa4266232ee0.jpeg)
Alert参数:
{ title: '', // 标题 content: '', // 内容 btns: [ // 按钮列表 text: "确定" // 按钮文字, handle: () => {} // 按钮事件 ], zIndex: 100, // 组件显示层级 }
注意:引用Alert组件需要引入 import "@/components/base.less"; 组件。
具体的Alert组件源码,请前往github地址获取。
https://github.com/AntJavascript/WidgetUI3.0/blob/master/Alert.vue