majiayin

npm 下载

npm install element-china-area-data -S

 

main.js

import {provinceAndCityData,regionData,provinceAndCityDataPlus,regionDataPlus,CodeToText,TextCode} from \'element-china-area-data\'
 
vue 文件
template 部分
 
<div class="linkage">
     <el-cascader size="large" :options="options" v-model="selectedOptions" @change="handleChange" placeholder="请选择省/市/区"></el-cascader>
 </div>
 
script 部分
 
import {regionData, CodeToText} from "element-china-area-data"
 
data 部分
//省市区三级联动
options : regionData,
selectedOptions : [],
 
methods 部分
handleChange(value){
            this.selectedOptions[0] = CodeToText[value[0]]
            this.selectedOptions[1] = CodeToText[value[1]]
            this.selectedOptions[2] = CodeToText[value[2]]
        },
 
 
 

分类:

技术点:

相关文章:

  • 2021-11-16
  • 2021-06-14
  • 2021-07-28
  • 2021-09-15
  • 2021-10-03
  • 2021-06-11
  • 2021-07-12
  • 2021-07-17
猜你喜欢
  • 2021-10-18
  • 2021-04-10
  • 2021-10-18
  • 2021-12-04
  • 2021-12-22
  • 2021-05-27
  • 2022-01-06
相关资源
相似解决方案