HMTL: <div class="block"> <span class="demonstration">國家/省份/城市/地區</span> <el-cascader :options="options" v-model="selectedOptions" @change="handleChange" :separator="' '" > </el-cascader> </div> // vue中的JS,從外面引入數據到options
import options from 'country-data.js'
data(){ return{ selectedOptions: [],//存放默認值 options:options //存放城市數據 } methods:{ handleChange(value) { console.log(value); } }
數據下載地址:https://github.com/Summer-Lin/country-datavue