5b34823b by 杨威

宗地双击事件

1 parent 7d23a82e
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
15 <div 15 <div
16 class="row-flex-start basic_banner" 16 class="row-flex-start basic_banner"
17 @click="itemClick(item)" 17 @click="itemClick(item)"
18 @dblclick="dbclick(item)"
18 :class="{ 19 :class="{
19 active_color: item.expand, 20 active_color: item.expand,
20 }" 21 }"
...@@ -70,14 +71,25 @@ export default { ...@@ -70,14 +71,25 @@ export default {
70 default: false, 71 default: false,
71 }, 72 },
72 }, 73 },
74 data() {
75 return {
76 time:null
77 }
78 },
73 methods: { 79 methods: {
74 itemClick(item) { 80 itemClick(item) {
81 let self = this;
82 // 开启延时器,300ms的间隔区分单击和双击,解决双击时执行两次单击事件
83 clearTimeout(self.time);
84 self.time = setTimeout(() => {
75 item.expand = !item.expand; 85 item.expand = !item.expand;
76 this.$emit("itemClick", item); 86 self.$emit("itemClick", item);
77 if (!item.children) { 87 if (!item.children) {
78 this.$emit("valClick", item); 88 self.$emit("valClick", item);
79 } 89 }
90 }, 300);
80 }, 91 },
92 // 右键点击事件
81 openMenu(e, item) { 93 openMenu(e, item) {
82 if (item.zdbsm) { 94 if (item.zdbsm) {
83 var x = e.pageX; 95 var x = e.pageX;
...@@ -100,6 +112,13 @@ export default { ...@@ -100,6 +112,13 @@ export default {
100 // this.left = x; 112 // this.left = x;
101 // this.visible = true; 113 // this.visible = true;
102 }, 114 },
115 // 左键双击事件
116 dbclick(item) {
117 clearTimeout(this.time);
118 if (item.zdbsm || item.zrzbsm) {
119 this.$router.push("/zd");
120 }
121 },
103 closeMenu() { 122 closeMenu() {
104 this.$emit("changeVisible", false); 123 this.$emit("changeVisible", false);
105 // this.visible = false; 124 // this.visible = false;
......
...@@ -119,7 +119,6 @@ export default { ...@@ -119,7 +119,6 @@ export default {
119 }, 119 },
120 // 根据id展开树的具体项 120 // 根据id展开树的具体项
121 expandTreeItemById(idList) { 121 expandTreeItemById(idList) {
122 debugger;
123 let _this = this; 122 let _this = this;
124 function loopTree(list) { 123 function loopTree(list) {
125 list.forEach((x) => { 124 list.forEach((x) => {
...@@ -221,6 +220,13 @@ export default { ...@@ -221,6 +220,13 @@ export default {
221 position: relative; 220 position: relative;
222 color: #ffffff; 221 color: #ffffff;
223 cursor: pointer; 222 cursor: pointer;
223 moz-user-select: -moz-none;
224 -moz-user-select: none;
225 -o-user-select: none;
226 -khtml-user-select: none;
227 -webkit-user-select: none;
228 -ms-user-select: none;
229 user-select: none;
224 .layer_text { 230 .layer_text {
225 flex: 1; 231 flex: 1;
226 } 232 }
......