Vue遍历这段如何解决重复问题

请问大神,如何让遍历出来的东西,江苏安徽只需要一个就够了。常州盐城扬州显示足够了,安徽的下一级隐藏

    
  

 export default{
   data(){
     return{
       list: [{
         "prov": "\u6c5f\u82cf",
         "city": "\u5e38\u5dde",
         "shop": "\u5e38\u5dde\u745e\u5f69\u6c7d\u8f66\u9500\u552e\u670d\u52a1\u6709\u9650\u516c\u53f8"
       }, {
         "prov": "\u6c5f\u82cf",
         "city": "\u76d0\u57ce",
         "shop": "\u76d0\u57ce\u4f17\u60e0\u6c7d\u8f66\u9500\u552e\u670d\u52a1\u6709\u9650\u516c\u53f8"
       }, {
         "prov": "\u6c5f\u82cf",
         "city": "\u626c\u5dde",
         "shop": "\u626c\u5dde\u767e\u745e\u6770\u6c7d\u8f66\u9500\u552e\u670d\u52a1\u6709\u9650\u516c\u53f8"
       }, {
         "prov": "\u5b89\u5fbd",
         "city": "\u5b89\u5e86",
         "shop": "\u5b89\u5e86\u5e02\u4e50\u745e\u884c\u6c7d\u8f66\u9500\u552e\u6709\u9650\u516c\u53f8"
       }, {
         "prov": "\u5b89\u5fbd",
         "city": "\u868c\u57e0",
         "shop": "\u868c\u57e0\u5e02\u6da6\u5229\u6c7d\u8f66\u9500\u552e\u670d\u52a1\u6709\u9650\u516c\u53f8"
       }, {
         "prov": "\u5b89\u5fbd",
         "city": "\u4eb3\u5dde",
         "shop": "\u5b89\u5fbd\u7701\u4eb3\u5dde\u5e02\u82f1\u65d7\u6c7d\u8f66\u9500\u552e\u670d\u52a1\u6709\u9650\u516c\u53f8"
       }, {
         "prov": "\u5b89\u5fbd",
         "city": "\u4eb3\u5dde",
         "shop": "\u8499\u57ce\u53bf\u82f1\u65d7\u6c7d\u8f66\u9500\u552e\u6709\u9650\u516c\u53f8"
       }, {
         "prov": "\u5b89\u5fbd",
         "city": "\u6c60\u5dde",
         "shop": "\u6c60\u5dde\u5e02\u4e07\u4f17\u5b9e\u4e1a\u6709\u9650\u8d23\u4efb\u516c\u53f8"
       }, {
         "prov": "\u5b89\u5fbd",
         "city": "\u6ec1\u5dde",
         "shop": "\u6ec1\u5dde\u5e02\u548c\u5947\u7965\u6c7d\u8f66\u9500\u552e\u670d\u52a1\u6709\u9650\u516c\u53f8"
       }]
     }
   }
 }

最佳答案

    

    

    
{

data(){
    return {
        prov:null,
        city:null,
        shop:null,
        list:[] // 替换你的list
    }
},
computed:{
    provinces(){
        let provs = {};
        return this.list.forEach((item)=>{
            provs[item.prov] =1;
        });
        return Object.keys(provs);
    },
    cities(){
        let page = this;
        return this.list.filter((item)=>{
            return item.prov == page.prov;
        }).map((item)=>{ return item.city; })
    },
    shops(){
        let page = this;
        return this.list.filter((item)=>{
            return item.city == page.city;
        }).map((item)=>{ return item.shop; })
    }
}

}