【uniapp】确认框(confirm)组件

近期,将会把以前帖子的uniapp组件封装好上传至uniapp插件市场。确认框已经弄好,这里给呈现给大家。
插件地址:添加链接描述

这个提示会展现在右下角,点击快时会一个个向上顶。
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

Confirm提示框

主要用于各种提示,目前支持info/warning/error/success


使用方法:

①安装vuex、lodash

npm install vuex -D
npm install lodash -D

②copy示例中components内容至项目中components

③copy示例中mixins,并在项目main.js引入,如:

import mixin from './mixins/index.js'
Vue.use(mixin)

④copy示例中store,并在项目main.js引入,如:

import store from './store/index.js'
Vue.prototype.$store = store
const app = new Vue({
    ...App,
	store
})

template调用示例:

<confirm></confirm> //注意:一个page,只能写一个,多写点击时会弹出多次

js调用示例:

1、成功

this.confirm_({
    name: "success",
    type: "success",
    message: "保存成功!"
})

2、警告

this.confirm_({
    name: "warning",
    type: "warning",
    message: "保存警告!",
    mask: true,
    closed: true,
    close: () => {this.returnClick = "保存警告close"}
})

3、错误

this.confirm_({
    name: "error",
    type: "error",
    message: "保存失败!",
    closed: true,
    close: () => {this.returnClick = "保存失败close"}
})

4、信息提示

this.confirm_({
    name: "info",
    type: "info",
    message: "保存信息!",
    confirmText: "保存", 
    cancelText: "取消",  
    confirm: () => {this.returnClick = "保存信息confirmText"},
    cancel: () => {this.returnClick = "保存信息cancelText"}, 
})

属性:

属性类型
nameString(必填)弹出框别名取唯一名称,避免多次弹出
typeString(必填)info/warning/error/success
maskBoolean默认值:falsetrue时为透明遮罩,进行其他操作无效,只能操作确认框
messageString“”提示内容
closedBoolean默认值:falsetype值为warning/error时使用,closed为true时点击右上角叉号,调用@close方法
confirmTextString“”type值为info时使用,更改确定按钮文字
cancelTextString“”type值为info时使用,更改取消按钮文字

方法:

名称
confirmtype=‘info’,确认方法
canceltype=‘info’,取消方法
closetype=‘warning/error’,关闭方法
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值