goodkind.vue 1.5 KB
<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>