routeItem.vue
1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<template>
<view
class="routeItem"
@click.stop="showMenu"
>
<view>
<text class="routeText">{{ item.path }}</text>
</view>
</view>
</template>
<script>
export default {
props: {
item: {
type: Object,
default: () => ({}),
},
},
data() {
return {};
},
methods: {
/**
* 展示菜单
*/
showMenu() {
let that = this;
let menuList = [];
let p = that.item.path.substr(0, 20);
if (p.length == 20) {
p = p + "...";
}
menuList.push(`复制路径(${p})`);
let isTabBar = false;
if (that.item.meta && that.item.meta.isTabBar) {
isTabBar = true;
}
if (!isTabBar) {
menuList.push("跳转至此页面");
}
uni.showActionSheet({
itemList: menuList,
success({ tapIndex }) {
if (tapIndex == 0) {
uni.setClipboardData({
data: that.item.path,
});
} else {
uni.$emit("devTools_showRouteDialog", that.item.path);
}
},
});
},
},
};
</script>
<style lang="scss" scoped>
.routeItem {
padding: 10rpx 20rpx;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
display: flex;
flex-direction: column;
.routeText {
width: 710rpx;
font-size: 20rpx;
line-height: 26rpx;
color: #333;
}
}
.routeItem:active {
background-color: rgba(0, 0, 0, 0.05);
}
</style>