<template> <view v-if="list.lenght!=0"> <view v-for="(item,index) in list" :key="index"> <!-- 一级title --> <view class="disjbac mar-x30 mar-s10"> <view class="fon34 bold col3">{{item.title}}</view> <image class="mar-y50" @tap="delSearch" v-if="item.src!=''" :src="item.src" style="width: 30rpx;height: 30rpx;" mode="heightFix"></image> </view> <view class="fon24 col6 disac fw"> <!-- 二级title --> <view @tap="choosetwo(index,indexo)" v-for="(itemo,indexo) in item.list" :key="indexo" class="radius10 mar-y20 flexs mar-x20 cate-tu-item">{{itemo.content}}</view> </view> </view> </view> </template> <script> export default { name:"cate-tu", props:{ list:{ type:Array, default:function(){ return [] } }, isDetail:{ type:Boolean, default:false } }, data() { return { }; }, methods:{ choosetwo(e1,e2){ // console.log('一级索引:',e1); // console.log('二级索引:',e2); // console.log(this.list[e1].list[e2].content); if(this.isDetail){ uni.navigateTo({ url:`/pagesB/problemDetail/problemDetail?id=${this.list[e1].list[e2].id}&category_id=${this.list[e1].list[e2].category_id}` }) } else { uni.navigateTo({ url:`/pagesB/searchPage/searchPage?keyWorld=${this.list[e1].list[e2].content}` }) } }, delSearch(){ // this.list = [] this.$emit('delev') } } } </script> <style> </style>