Parcourir la source

按钮限制点击一次

duy il y a 2 ans
Parent
commit
6786ad05d5
3 fichiers modifiés avec 2 ajouts et 22 suppressions
  1. 1 3
      src/main.js
  2. 0 16
      src/util/preventClick.js
  3. 1 3
      src/views/exctab/ElementIdentification/index.vue

+ 1 - 3
src/main.js

@@ -33,9 +33,7 @@ import tenantPackage from './views/system/tenantpackage';
 
 //iconfont
 import "@/styles/icon/index.scss"
-//自定义指令按钮
-import preventClick from './util/preventClick'
-Vue.use(preventClick)
+
 // 注册全局crud驱动
 window.$crudCommon = crudCommon;
 // 加载Vue拓展

+ 0 - 16
src/util/preventClick.js

@@ -1,16 +0,0 @@
-export default {
-     install(Vue) {
-       Vue.directive('preventClick', {
-         inserted(button, bind) {
-          button.addEventListener('click', () => {
-          if (!button.disabled) {
-               button.disabled = true;
-               setTimeout(() => {
-                button.disabled = false
-              }, 2000)
-             }
-           })
-         }
-       })
-     }
-   }

+ 1 - 3
src/views/exctab/ElementIdentification/index.vue

@@ -663,7 +663,7 @@
           </div>
         <span slot="footer" class="dialog-footer">
           <el-button @click="eleDialog = false">取 消</el-button>
-          <el-button type="primary" @click="submitEleDialog" v-preventClick>确 定</el-button>
+          <el-button type="primary" @click.once="submitEleDialog" >确 定</el-button>
         </span>
       </el-dialog>
     </div>
@@ -1103,8 +1103,6 @@ export default {
             this.eleForm.tableType &&
             this.eleForm.tableOwner
           ) {
-   
-           
             this.submitExcelRelationWbsTreeAndElement({
               nodeName: this.eleForm.nodeName,
               tableType: this.eleForm.tableType,