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
78
79
80
81
82
83
84
85
86
87
88
| <template>
| <view>
| <!--图标入口-->
| <view class="diy-navbar" :style="{background:itemData.style.background}">
| <view class="item" v-for="(item, index) in itemData.data" :key="index" :style="'width:'+item_width+';'" @click="gotoDetail(item)">
| <image :src="item.imgUrl" mode="widthFix"></image>
| <text class="gray3" :style="{color:item.color}">{{item.text}}</text>
| <!-- <navigator class="btn" target="miniProgram" open-type="navigate" :app-id="item.inputname" version="trial">{{item.text}}</navigator> -->
| </view>
| </view>
| </view>
| </template>
|
| <script>
| export default {
| data() {
| return {
| //单个宽度
| item_width: '25%'
| }
| },
| props: ['itemData'],
| created() {
| this.item_width = 100 / Math.abs(this.itemData.style.rowsNum) + '%';
| },
| methods: {
|
| /*跳转页面*/
| gotoDetail(e) {
| if(e.type && e.type == "小程序"){
| wx.navigateToMiniProgram({
| appId: e.inputname,
| path: e.linkUrl,
| extarData: {
| open: 'happy'
| },
| envVersion: 'release',
| success(res) {
| // 打开成功
| console.log("成功")
| }
| })
|
| }else{
| this.gotoPage(e.linkUrl);
| }
| }
| }
| }
| </script>
|
| <style>
| .diy-navbar {
| /* margin: 20rpx; */
| padding: 20rpx 0;
| border-radius: 6rpx;
| background: #FFFFFF;
| display: flex;
| justify-content: flex-start;
| flex-wrap: wrap;
| }
|
| .diy-navbar .item {
| display: flex;
| flex-direction: column;
| justify-content: center;
| align-items: center;
| margin-top: 20rpx;
| width: 120rpx;
| height: 140rpx;
| }
|
| .diy-navbar .item image {
| width: 70rpx;
| height: 70rpx;
| }
|
| .diy-navbar .item text {
| display: block;
| text-overflow: ellipsis;
| white-space: nowrap;
| width: 100%;
| overflow: hidden;
| line-height: 66rpx;
| font-size: 26rpx;
| text-align: center;
| }
| </style>
|
|