Commit 02aecb3d authored by 杨梦雪's avatar 杨梦雪

防止重复点击指令

parent ed6401bd
...@@ -17,6 +17,10 @@ Vue.use(ElementUI) ...@@ -17,6 +17,10 @@ Vue.use(ElementUI)
Vue.prototype.download = download Vue.prototype.download = download
Vue.prototype.upload = upload Vue.prototype.upload = upload
// 防止重复点击自定义属性
import preventReClick from './utils/preventRepeatClick.js'
Vue.use(preventReClick);
Vue.prototype.$errorScroll = function errorScroll(callback) { Vue.prototype.$errorScroll = function errorScroll(callback) {
this.$nextTick(() => { this.$nextTick(() => {
// this.loading = false; // this.loading = false;
......
export default {
install (Vue) {
Vue.directive('preventReClick', {
inserted(el, binding) {
el.addEventListener('click', () => {
if(!el.disabled) {
el.disabled = true;
setTimeout(() => {
el.disabled = false;
}, binding.value || 1000);
}
})
}
})
}
}
\ No newline at end of file
...@@ -246,7 +246,9 @@ ...@@ -246,7 +246,9 @@
</div> </div>
<el-form-item class="btn" v-if="student_status == 0"> <el-form-item class="btn" v-if="student_status == 0">
<el-button type="primary" @click="confirm">提交</el-button> <el-button type="primary" v-preventReClick="1000" @click="confirm"
>提交</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment