vue-simple-swalert
swalert组件,适用于uni-app。
说明
项目说明 样式引用项目 wepy-simple-toast
使用
安装组件
npm i vue-sample-swalert
引入
// main.js 全局引入
import swalert from 'vue-simple-swalert';
Vue.component('swalert',swalert);
// template
<template>
<view>
//这里是你的页面内容...
<swalert ref="swalert"/> //注意 ref
</view>
</template>
<script>
export default {
//
methods: {
// args1 => title ,标题内容
// args2 => Object , 可以定义对象
this.$openSwalert("title", { showIcon: true , ... })
}
}
</script>
调用方法
// 全局方法
this.$openSwalert(title, options);
this.$successSwalert(title, options);
this.$errorSwalert(title, options);
this.$hideSwalert(title, options);
- options 参数当前只有
showIcon
,showCloseBar
,showClose
,showBtn
,showConfirm
等等可用