当前位置: 首页 > news >正文

衡阳市住房和城乡建设局网站河北百度推广

衡阳市住房和城乡建设局网站,河北百度推广,阳江招聘网最新招聘信息网兼职,企业手机网站建设流程在做后台的时候需要用到地区级联选择器 然后就自己封装了一个 其中 组件页面中 export default {props: { //使用value接收引用页面的绑定值value: [String]},watch: {value: {handler(val) {//val 以及 this.value 都可以获取到引用页面的绑定值},deep: true,immediate: tr…

在做后台的时候需要用到地区级联选择器 然后就自己封装了一个

其中 组件页面中

export default {props: {		//使用value接收引用页面的绑定值value: [String]},watch: {value: {handler(val) {//val 以及 this.value 都可以获取到引用页面的绑定值},deep: true,immediate: true}},
}
//this.$emit("input", this.changeForm()); 这句代码是给引用页面绑定值返回内容

完整地区json文件在网盘中

链接:https://pan.quark.cn/s/0b70e60fd377
提取码:4sSe

下面是完整代码:

引用页面中

<select-address v-model="form.applicableRange"/>

main.js中注册组件

import SelectAddress from '@/components/SelectAddress'Vue.component('SelectAddress', SelectAddress)

组件页面

<template><div class="selectAddress"><el-form :model="form"><el-select v-model="form.provincial" @change="updateProvincials()" clearableplaceholder="请选择省份"><el-option v-for="provincial in provincials" :key="provincial.label" :value="provincial.label":label="provincial.label"/></el-select><el-select v-model="form.municipal" @change="updateMunicipals()"placeholder="请选择城市"><el-option v-for="municipal in municipals" :key="municipal.label" :value="municipal.label":label="municipal.label"/></el-select><el-select v-model="form.regional" @change="updateRegionals()"placeholder="请选择地区"><el-option v-for="regional in regionals" :key="regional.label" :value="regional.label":label="regional.label"/></el-select><el-select v-model="form.streets" @change="updateStreetss()"placeholder="请选择街道"><el-option v-for="streets in streetss" :key="streets.label" :value="streets.label" :label="streets.label"/></el-select></el-form></div>
</template>
<script>
const options = require("@/assets/images/pcas-code.json");
export default {props: {value: [String]},data() {return {form: {provincial: null,municipal: null,regional: null,streets: null,},provincials: options,municipals: [],regionals: [],streetss: [],}},watch: {value: {handler(val) {if (val) {const list = this.value.split(' ');if(list.length == 1){this.form.provincial = list[0];this.updateProvincials();}else if(list.length == 2){this.form.provincial = list[0];this.updateProvincials();this.form.municipal = list[1];this.updateMunicipals();}else if(list.length == 3){this.form.provincial = list[0];this.updateProvincials();this.form.municipal = list[1];this.updateMunicipals();this.form.regional = list[2];this.updateRegionals();}} else {this.reset();return [];}},deep: true,immediate: true}},mounted() {},created() {},computed: {},methods: {reset() {this.form = {provincial: null,municipal: null,regional: null,streets: null}},updateProvincials() {this.form.municipal = "";this.form.regional = "";this.form.streets = "";this.municipals = [];this.regionals = [];this.streetss = [];this.$emit("input", this.changeForm());if(this.form.provincial){this.municipals = this.provincials.find(provincial => provincial.label == this.form.provincial).children;}},updateMunicipals() {this.form.regional = "";this.form.streets = "";this.regionals = [];this.streetss = [];this.$emit("input", this.changeForm());this.regionals = this.municipals.find(municipal => municipal.label == this.form.municipal).children;},updateRegionals() {this.form.streets = "";this.streetss = [];this.$emit("input", this.changeForm());this.streetss = this.regionals.find(regional => regional.label == this.form.regional).children;},updateStreetss() {this.$emit("input", this.changeForm());},changeForm(){let applicableRange = "";if(this.form.provincial){applicableRange = this.form.provincial}if(this.form.provincial && this.form.municipal){applicableRange = this.form.provincial + " " + this.form.municipal}if(this.form.provincial && this.form.municipal && this.form.regional){applicableRange = this.form.provincial + " " + this.form.municipal + " " + this.form.regional}if(this.form.provincial && this.form.municipal && this.form.regional && this.form.streets){applicableRange = this.form.provincial + " " + this.form.municipal + " " + this.form.regional + " " + this.form.streets}return applicableRange;}},
}
</script><style scoped lang="scss">
.el-select {width: 18%;margin-left: 1%;
}
</style>
http://www.hkea.cn/news/285628/

相关文章:

  • 网站一元空间有哪些呀品牌策划方案范文
  • 最便宜的网站建设企点
  • 网站代码加密深圳新闻今日最新
  • 不要钱做网站软件网站seo优化效果
  • 公司做网站提供产品加盟费互联网销售怎么做
  • 视频网站开发架构百度app最新版本
  • 网站上内容列表怎么做的网站模板中心
  • 上海利恩建设集团有限公司网站国内好用的搜索引擎
  • 网站模板论坛今日重大军事新闻
  • 昆山自适应网站建设电商平台的营销方式
  • 盘龙区网站建设外包高级搜索引擎技巧
  • 什么做的网站吗58百度搜索引擎
  • wordpress 企业站开发口碑营销的概念
  • 广州免费核酸检测点东莞seo项目优化方法
  • 学风建设网站版块设计个人网站
  • 网站底部连接怎么做福州seo推广
  • 生猪价格今日猪价行情关键词优化是什么工作
  • 网站建设公司下载搜索引擎查询
  • 韩国吃秀在哪个网站做直播企业宣传
  • 江西网站建设成都百度
  • 糯米团网站怎么做微信软文范例100字
  • 如何在社交网站上做视频推广seo营销的概念
  • 大连做网站仟亿科技最新域名查询
  • 网站开发实施计划与安排宁波网络推广方式
  • 企业网站建设公司注意哪些问题软件开发外包公司
  • abc网站建设怎么样yandex引擎搜索入口
  • wordpress屏蔽f12广州seo网络优化公司
  • 南宁网站建设推广服务云服务器免费
  • 大数据营销是什么seo站长
  • 建设政府网站的公司乐山网站seo