Browse Source

PDA端处理多次触发事件,防止重复点击文件已添加,直接调用就行

hella_online_20240829
zhang_li 3 months ago
parent
commit
d577fd4469
  1. 2
      src/common/directory.js
  2. 25
      src/common/noclick.js
  3. 7
      src/main.js

2
src/common/directory.js

@ -617,12 +617,10 @@ export function getPackUnitName(value) {
//获取优先级
export function getPriorityName(value) {
console.log(344,value)
var resultInfo = "";
if (priorityList.length == 0) {
priorityList = getDirectoryInfo("priority")
}
console.log(455,priorityList)
if (priorityList.length > 0) {
for (let item of priorityList) {
if (item.value == value) {

25
src/common/noclick.js

@ -0,0 +1,25 @@
// 防止处理多次点击
function noMultipleClicks(methods, info) {
// methods是需要点击后需要执行的函数, info是点击需要传的参数
let that = this;
if (that.noClick) {
// 第一次点击
that.noClick= false;
if(info && info !== '') {
// info是执行函数需要传的参数
methods(info);
} else {
methods();
}
setTimeout(()=> {
that.noClick= true;
}, 2000)
} else {
// 这里是重复点击的判断
}
}
//导出
export default {
noMultipleClicks,//禁止多次点击
}

7
src/main.js

@ -4,10 +4,12 @@ import './router/my_router.js'; //引入拦截
import VueClipboard from 'vue-clipboard2' //复制粘贴
import uView from './uni_modules/vk-uview-ui';// 引入 uView UI
import comMessage from './mycomponents/common/comMessage.vue'
import noclick from './common/noclick.js'
// #ifndef VUE3
import Vue from 'vue'
console.log("Vuew2222");
console.log("Vuew2222");//配置公共方法 防治多次点击
Vue.config.productionTip = false
Vue.prototype.$store = store
Vue.prototype.$adpid = "1111111111"
@ -33,8 +35,7 @@ export function createApp() {
app.use(VueClipboard)
app.use(uView)
app.component('comMessage', comMessage)
console.log("网络22请求")
app.config.globalProperties.$noMultipleClicks = noclick.noMultipleClicks;
// startApp(app);
return {
app,

Loading…
Cancel
Save