- ###disabled <button @click="withdrawMoney()" :disabled="submitDisabled">提交</button>
-
<script> export default{ ready(){ this.submitDisabled = false; //初始化为face表示是可以点击的 }, data () { return { submitDisabled:false;//提交按钮是否可点击 false是可点击,true不可点击 } }, methods:{ withdrawMoney () { if(Number(this.balance)<10){ this.setTip({ text: '提现金额不得低于10元' }); return false } this.submitDisabled = true //判断条件结束后点击按钮后就禁止再次点击 this.$http({}).then (res) =>{ let data = JsonParse(res.data) if(data.statusCode === 200){ }else{ //请求数据失败之后可以再次点击 this.submitDisabled = false } } } } } </script>
转载于:https://my.oschina.net/pingheyongfeng/blog/1204478