|
|
2021年7月新版本无需引用任何组件,只需引用css即可。
1.你创建的页面.vue或nvue,本人喜欢用vue.
2.文件如下:
<template>
<view class="">
<button class="zai-btn popup-success" @click="Chebtn('success')">更新</button>
<!-- 提示窗示例 -->
//这个是提示的内容,可请参考pades/extUI/popup/popup.nvue
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog :type="msgType" title="通知" content="欢迎使用 uni-popup!" @confirm="dialogConfirm" @close="dialogClose">
</uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
type: 'center',
msgType: 'success',
messageText: '这是一条成功提示',
value: ''
}
},
methods: {
//提交的按钮*作,里面是type
Chebtn(type){
success: (e) => {
if (e.data.code == 0) {
//当数据成功或失败回调以后,这里我不使用uni.showModal,直接使用
//this.msgType = type
//this.$refs.alertDialog.open()
/*uni.showModal({
title: '提示',
content: '更新成功',
//cancelText: "取消", // 取消按钮的文字
confirmText: "确定", // 确认按钮文字
showCancel: false,
confirmColor: '#f55850',
//cancelColor: '#39B54A',
});*/
//用popup.vue的样式
this.msgType = type
this.$refs.alertDialog.open()
} else {
this.msgType = "更新失败"
this.$refs.alertDialog.open()
}
},
}
}
|
|