goodkind.vue
1.5 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
<template>
<view class="content">
<view class="commnonpadding flexone kindbox">
<view class="goodlinditem flexfour" v-for="(item,index) in kindlist" :key="index" @click="selectgood" :data-id="item.id">
<view class="goodkindimg">
<image :src="item.image" mode=""></image>
</view>
<view class="goodkindname hidden">{{item.name}}</view>
</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
export default {
data() {
return {
showbanben: false,
kindlist:[],
score_category_id:''
}
},
onLoad() {
this.getgoodkind()
},
methods: {
getgoodkind(){
let that = this;
var url = 'score_goods/get_score_category';
var params = {
}
app.post(url, params).then((res) => {
console.log(res);
that.kindlist=res.data.data
}).catch((err) => {
})
},
selectgood(e){
let id=e.currentTarget.dataset.id;
// let pages = getCurrentPages();
// let prevPage = pages[pages.length - 2]; //上一个页面
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
uni.setStorageSync("selectId",id)
// prevPage.setData({
// selectId: id,
// });
uni.navigateBack({
checked:true
})
}
}
}
</script>
<style>
@import url('../../base/homepage');
</style>