<view>
<button class="comment-save" bindtap="onSave">保存</button>
</view>
onSave:function(){
var form=this.data.form
if(!form.img || !form.content){
wx.showToast({
title:'表单不能为空!'
})
return;
// 程序不再执行,结束
}
}
.comment-save{
display:flex;
align-items: center;
justify-content: center;
text-align: center;
margin-top: 20px;
color: #FFF;
background-color: #2e79fc !important;
border-radius: 10px;
height: 45px;
line-height: 45px;
width: 70%;
margin-bottom: 15rpx;
}