5b34823b by 杨威

宗地双击事件

1 parent 7d23a82e
......@@ -15,6 +15,7 @@
<div
class="row-flex-start basic_banner"
@click="itemClick(item)"
@dblclick="dbclick(item)"
:class="{
active_color: item.expand,
}"
......@@ -70,14 +71,25 @@ export default {
default: false,
},
},
data() {
return {
time:null
}
},
methods: {
itemClick(item) {
let self = this;
// 开启延时器,300ms的间隔区分单击和双击,解决双击时执行两次单击事件
clearTimeout(self.time);
self.time = setTimeout(() => {
item.expand = !item.expand;
this.$emit("itemClick", item);
self.$emit("itemClick", item);
if (!item.children) {
this.$emit("valClick", item);
self.$emit("valClick", item);
}
}, 300);
},
// 右键点击事件
openMenu(e, item) {
if (item.zdbsm) {
var x = e.pageX;
......@@ -100,6 +112,13 @@ export default {
// this.left = x;
// this.visible = true;
},
// 左键双击事件
dbclick(item) {
clearTimeout(this.time);
if (item.zdbsm || item.zrzbsm) {
this.$router.push("/zd");
}
},
closeMenu() {
this.$emit("changeVisible", false);
// this.visible = false;
......
......@@ -119,7 +119,6 @@ export default {
},
// 根据id展开树的具体项
expandTreeItemById(idList) {
debugger;
let _this = this;
function loopTree(list) {
list.forEach((x) => {
......@@ -221,6 +220,13 @@ export default {
position: relative;
color: #ffffff;
cursor: pointer;
moz-user-select: -moz-none;
-moz-user-select: none;
-o-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
.layer_text {
flex: 1;
}
......