dialog 组件使⽤步骤
第⼀步: 将components组件复制放在app.js同级
第⼆步: 在需要⻚⾯引⼊ js部分 data: {
visible: false
}
onReady: function () {
this.Modal = this.selectComponent("#modal");
},
onReady: function () {
this.Modal = this.selectComponent("#modal");
},
// 取消按钮以及确定按钮的回调事件
_onShowModal: function (e) {
this.Modal.showModal(); // 控制modal显示
},
_confirmEventFirst: function () {
console.log(“点击确定了!”);
this.Modal.hideModal();// 控制modal隐藏
},
_cancelEvent: function () {
console.log(“点击取消!”);
}
Json部分
{
“usingComponents”: {
“dialog”: “/components/dialog”
}
}
wxml部分
弹框
wxss部分
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
}
.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.userinfo-nickname {
color: #aaa;
}
.usermotto {
margin-top: 200px;
}