chooseNum.vue
2.9 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<template>
<view class="u-page__item">
<view class="" v-if="itemArr && itemArr.length > 0">
<u-collapse accordion v-for="item in itemArr" @close="close">
<view class="" @click="backHub(item)">
<u-collapse-item :title="item.name">
<text class="u-collapse-content" v-if="item.children && item.children.length>0"
v-for="item1 in item.children" @click="backHub1(item1)">{{item1.name}}</text>
</u-collapse-item>
</view>
</u-collapse>
</view>
<view class="" v-else style="margin-top: 40%;">
<u-empty></u-empty>
</view>
</view>
<!-- <view style="margin: 24rpx 0;">
<u-index-list :index-list="indexList">
<template v-for="(item, index) in itemArr">
<!-- #ifdef APP-NVUE -->
<!-- <u-index-anchor :text="indexList[index]"></u-index-anchor> -->
<!-- <u-index-item> --> -->
<!-- #ifndef APP-NVUE
<u-index-anchor :text="indexList[index]"></u-index-anchor>
<!-- #endif --> -->
<!-- <view class="list-cell" v-for="(cell, index1) in item.list" @click="backHub(cell)">
{{cell.name}}
</view>
</u-index-item>
</template>
</u-index-list> -->
</template>
<script>
export default {
data() {
return {
indexList: [],
itemArr: [
]
}
},
methods: {
backHub(item) {
if (item.children && item.children.length > 0) {
return
} else {
this.backHub1(item)
}
},
backHub1(item) {
let pages = getCurrentPages(); //获取所有页面栈实例列表
let prevPage = pages[pages.length - 2]; //上一页页面实例
prevPage.$vm.xh_id = item.id;
prevPage.$vm.xh_name = item.name;
uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
delta: 1
});
},
open(e) {
// console.log('open', e)
},
close(e) {
console.log('close', e)
},
change(e) {
// console.log('change', e)
}
},
onLoad(option) {
let brand_id = ''
let category_id = ''
if(option && option.category_id !== 'undefined' && option.brand_id !== 'undefined'){
brand_id = option.brand_id
category_id = option.category_id
}
uni.$u.http.get(`/api/index/xinghao_list?category_id=${category_id}&brand_id=${brand_id}`).then(
res => {
// this.indexList = res.data.word
this.itemArr = res.data.data
}).catch(err => {
console.log(err);
})
}
}
</script>
<style scoped lang="scss">
/deep/ .u-collapse {
background-color: white;
}
.list-cell {
display: flex;
box-sizing: border-box;
width: 100%;
padding: 10px 24rpx;
overflow: hidden;
color: #323233;
font-size: 14px;
line-height: 24px;
background-color: #fff;
}
.u-page {
padding: 0;
&__item {
&__title {
color: $u-tips-color;
background-color: $u-bg-color;
padding: 15px;
font-size: 15px;
&__slot-title {
color: $u-primary;
font-size: 14px;
}
}
}
}
.u-collapse-content {
color: $u-tips-color;
font-size: 14px;
margin: 15rpx 10rpx;
}
</style>