vant地区三级联动

     <van-cell-group>
            <!--cell+popup+area省市区的坑-->
            <van-cell v-model="carmodel"  value @click="shows = true"></van-cell>
            <van-popup v-model="shows" position="bottom">
              <van-area
                ref="area"
                value="110000"
                :area-list="areaList"
                @change="onChange"
                @confirm="shows = false"
                @cancel="shows = false"
              />
            </van-popup>
          </van-cell-group>
 
import { Cell, CellGroup, Popup, Field,  Area, Picker } from 'vant'
 data() {
    return {
shows: false,
      areaList,
      carmodel: "省/市/区",
    };
  },
 
 
 
 methods: {
    onChange(picker, value, index) {
      console.log("当前值:" + value + "当前索引:" + index);

      let areaName = "";
      for (var i = 0; i < value.length; i++) {
        areaName = areaName + value[i].name + " ";
      }
      this.carmodel = areaName;
    },

  },
posted @ 2020-06-10 20:45  web小超  阅读(936)  评论(0编辑  收藏  举报