web前端|js教程
点击,多次,按钮
web前端-js教程事件分为两种情况:
2048 android源码,vscode滚动条实现方式,ubuntu定时执行,tomcat 查线程数,python爬虫任务,php数据库备份类,黄骅关键词seo优化报价lzw
•第一种: 不操作数据型
php校园论坛源码,小新pro装ubuntu,scrapy爬虫实用吗,save php,seo分析公司lzw
•第二种: 操作数据型
博客cms系统源码,ubuntu修改手机固件,tomcat8类加载器,牛屎爬虫,php操作系统好处,中山seo管理lzw
export default { name: TestButton, data: function () { return { isDisable: false } }, methods: { submit() { this.isDisable = true setTimeout(() => {this.isDisable = false }, 1000) } }, }
这里我们通过控制isDisable 来设置 disabled来控制按钮的点击和不可点击。 默认isDisable:的值为 false,按钮可以点击。 当我们点击这个按钮的时候,首先将按钮的绑定isDisable设置为true,1秒后立马将其置为false。 所以用户只能有一秒的时间去操作这个按钮。
下面给大家补充一个实例代码
vue中button多次点击重复提交的实例代码
sendComment () {this.disabled = trueif (this.text == \){this.$message({type:error,message:输入内容不能为空,})this.disabled = false}else{this.$post(/xx/xx/IdleGoodsComment,{goods_id:this.$route.params.id,content:this.text,user_id:window.uId,type:1}).then((res) => {if(res){this.getDetail()setTimeout(()=>{this.disabled=falsethis.getCommentList()this.text = \},2000)this.disabled = true}})}}