最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue自定義省市區(qū)三級聯(lián)動

 更新時間:2022年03月08日 15:14:11   作者:面壁思過程  
這篇文章主要為大家詳細(xì)介紹了Vue自定義省市區(qū)三級聯(lián)動,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Vue自定義省市區(qū)三級聯(lián)動的具體代碼,供大家參考,具體內(nèi)容如下

1.如圖(省市區(qū)加上全部聯(lián)動)

第一步:找到了一個普通的省市區(qū)先進(jìn)行遍歷更改

2.把更改后的json文件放入vue項(xiàng)目中引入到你想要的頁面

3.剩余代碼如下

<template>
? <div class="percentloop">
? ? ?<!-- 地區(qū)選擇 -->
? ? ? <section class="section">
? ? ? ? <p class="tittle">
? ? ? ? ? <span class="important_font">*</span>
? ? ? ? ? <span>地區(qū)篩選</span>
? ? ? ? </p>
?
? ? ? ? <div class="box">
? ? ? ? ? <div class="area">
? ? ? ? ? ? <!-- 省 -->
? ? ? ? ? ? <li class="area-menu province-list">
? ? ? ? ? ? ? <div class="area-msg" @click.stop="show(0)">
? ? ? ? ? ? ? ? {{areaList[province].provinceName}}
? ? ? ? ? ? ? </div>
? ? ? ? ? ? ? <ul v-show="showindex[0]">
? ? ? ? ? ? ? ? <li v-for="(item,index) in areaList" :key="index"
? ? ? ? ? ? ? ? ? @click.stop="selprovinceName(index,item.provinceName)">
? ? ? ? ? ? ? ? ? {{item.provinceName}}
? ? ? ? ? ? ? ? </li>
? ? ? ? ? ? ? </ul>
? ? ? ? ? ? </li>
? ? ? ? ? ? <span class="text">省</span>
?
? ? ? ? ? ? <!-- 市 -->
? ? ? ? ? ? <li class="area-menu city-list">
? ? ? ? ? ? ? <div class="area-msg" @click.stop="show(1)">
? ? ? ? ? ? ? ? {{areaList[province].areaVOList[cityIndex].cityName}}
? ? ? ? ? ? ? </div>
? ? ? ? ? ? ? <ul v-show="showindex[1]">
? ? ? ? ? ? ? ? <li v-for="(item,index) in areaList[province].areaVOList" :key="index"
? ? ? ? ? ? ? ? ? @click.stop="selcityName(index,item.cityName)">
? ? ? ? ? ? ? ? ? {{item.cityName}}
? ? ? ? ? ? ? ? </li>
? ? ? ? ? ? ? </ul>
? ? ? ? ? ? </li>
? ? ? ? ? ? <span class="text">市</span>
?
? ? ? ? ? ? <!-- 區(qū) -->
? ? ? ? ? ? <li class="area-menu region-list">
? ? ? ? ? ? ? <div class="area-msg" @click.stop="show(2)">
? ? ? ? ? ? ? ? {{areaList[province].areaVOList[cityIndex].areaVOList[countyIndex].countyName}}
? ? ? ? ? ? ? </div>
? ? ? ? ? ? ? <ul v-show="showindex[2]" style="right:-40px;">
? ? ? ? ? ? ? ? <li v-for="(item,index) in areaList[province].areaVOList[cityIndex].areaVOList" :key="index"
? ? ? ? ? ? ? ? ? @click.stop="selcountyName(index,item.countyName)">
? ? ? ? ? ? ? ? ? {{item.countyName}}</li>
? ? ? ? ? ? ? </ul>
? ? ? ? ? ? </li>
?
? ? ? ? ? ? <span class="text">區(qū)/縣</span>
? ? ? ? ? </div>
? ? ? ? </div>
? ? ? </section>
?
?
? </div>
</template>
?
<script>
? let data = {
? ? areaList: [], //省市區(qū)三級聯(lián)動的數(shù)據(jù)
? ? ? ? InitializeList: [], //我寫得聯(lián)動數(shù)據(jù)
?
? ? ? ? showindex: [false, false, false], //控制省市區(qū)彈框顯示
?
? ? ? ? province: 0, //默認(rèn)省下標(biāo)
? ? ? ? cityIndex: 0, //默認(rèn)市下標(biāo)
? ? ? ? countyIndex: 0, //默認(rèn)區(qū)下標(biāo)
?
? ? ? ? istoubi: false,
? ? ? ? selectType: 0, //默認(rèn)廣告類型索引 ? 全部
? ? ? ? attr1Index: -1, //默認(rèn)廣告位置類型索引 ??
? ? ? ? attr2Index: -1, //默認(rèn)設(shè)備類型索引 ? ?
?
? ? ? ? //發(fā)送給后臺的值
? ? ? ? address_str: ['全部', '全部', '全部'], //地址
?
? ? ? ? select_parmas: {
? ? ? ? ? county: '全部,全部,全部', //省市區(qū)
? ? ? ? ? selectTypeID: -1, //選擇的廣告類型id
? ? ? ? ? selectAttr1ID: -1, //選擇的廣告位置id
? ? ? ? ? selectAttr2ID: -1, //選擇的設(shè)備類型id
? ? ? ? }
? }
?
? $('html').click(function (e) {
? ? data.showindex = [false, false, false]
? })
?
? import Area from '../../static/json/area.json'
?
? export default {
? ? data() {
? ? ? return data
? ? },
? ? created() {
? ? ? console.log(this.area)
? ? ? this.areaList = this.area[0];
?
? ? ? // console.log(Area)
? ? ? // this.areaList = Area[0];
? ? },
?
? ? methods: {
?
? ? ?//顯示下拉框
? ? ? show(index) {
? ? ? ? let arr = [...this.showindex];
? ? ? ? //彈框顯示時 直接全部隱藏
? ? ? ? if (arr[index] == true) {
? ? ? ? ? arr = [false, false, false]
? ? ? ? } else {
? ? ? ? ? arr = [false, false, false] //初始化全部隱藏
? ? ? ? ? arr[index] = true
? ? ? ? }
?
? ? ? ? this.showindex = arr;
? ? ? },
?
? ? ? //省的點(diǎn)擊事件
? ? ? selprovinceName(index, value) {
? ? ? ? this.showindex = [false, false, false]
?
? ? ? ? this.province = index;
? ? ? ? this.cityIndex = 0; //默認(rèn)市下標(biāo)
? ? ? ? this.countyIndex = 0; //默認(rèn)區(qū)下標(biāo)
?
? ? ? ? let address = [...this.address_str]
? ? ? ? address[0] = value;
? ? ? ? this.address_str = address;
?
? ? ? },
?
? ? ? //市的點(diǎn)擊事件
? ? ? selcityName(index, value) {
? ? ? ? this.showindex = [false, false, false]
? ? ? ? this.cityIndex = index;
? ? ? ? this.countyIndex = 0; //默認(rèn)區(qū)下標(biāo)
?
? ? ? ? let address = [...this.address_str]
? ? ? ? address[1] = value;
? ? ? ? this.address_str = address;
? ? ? },
?
? ? ? //區(qū)的點(diǎn)擊事件
? ? ? selcountyName(index, value) {
? ? ? ? this.showindex = [false, false, false]
? ? ? ? this.countyIndex = index;
?
? ? ? ? let address = [...this.address_str]
? ? ? ? address[2] = value;
? ? ? ? this.address_str = address;
? ? ? },
?
? ? },
?
? }
?
</script>
?
<style scoped lang="scss">
? @import "../common/common";
? .section {
? ? ? box-sizing: border-box;
? ? ? margin-bottom: 0.38rem;
?
? ? ? .tittle {
? ? ? ? margin-bottom: 0.2rem;
? ? ? }
?
? ? ? .box {
? ? ? ? .labelspan {
? ? ? ? ? margin-right: 0.18rem;
? ? ? ? ? margin-bottom: 0.19rem;
? ? ? ? ? box-sizing: border-box;
? ? ? ? }
?
? ? ? ? //視頻時長
? ? ? ? .longvalue {
? ? ? ? ? display: flex;
? ? ? ? ? flex-wrap: nowrap;
? ? ? ? ? align-items: center;
? ? ? ? ? margin-bottom: 0.1rem;
?
? ? ? ? ? .time_box {
? ? ? ? ? ? width: 1.6rem;
? ? ? ? ? ? height: 0.56rem;
? ? ? ? ? ? line-height: 0.56rem;
? ? ? ? ? ? border: 1px solid rgba(230, 230, 230, 1);
? ? ? ? ? ? border-radius: 0.1rem;
? ? ? ? ? ? padding-left: 0.38rem;
? ? ? ? ? ? margin: 0 0.17rem;
?
? ? ? ? ? }
? ? ? ? }
?
?
? ? ? ? //選擇投放時間
? ? ? ? .slect {
? ? ? ? ? width: 100%;
? ? ? ? ? line-height: 0.56rem;
? ? ? ? ? border: 1px solid rgba(230, 230, 230, 1);
? ? ? ? ? border-radius: 0.1rem;
? ? ? ? ? padding-left: 0.2rem;
? ? ? ? ? color: #4984EB;
? ? ? ? }
?
? ? ? ? //選擇時間段
? ? ? ? .slect_time {
? ? ? ? ? display: flex;
? ? ? ? ? flex-wrap: nowrap;
? ? ? ? ? align-items: center;
?
? ? ? ? ? .middle {
? ? ? ? ? ? margin: 0 0.24rem;
? ? ? ? ? ? line-height: 0.56rem;
? ? ? ? ? }
?
? ? ? ? ? .time_box {
? ? ? ? ? ? width: 1.6rem;
? ? ? ? ? ? height: 0.56rem;
? ? ? ? ? ? line-height: 0.56rem;
? ? ? ? ? ? border: 1px solid rgba(230, 230, 230, 1);
? ? ? ? ? ? border-radius: 0.1rem;
? ? ? ? ? ? padding-left: 0.38rem;
? ? ? ? ? }
? ? ? ? }
?
?
? ? ? }
?
? ? ? .tip {
? ? ? ? // ? margin-top:?
? ? ? }
? ? }
?
?
? ? ? .area {
? ? display: flex;
? ? flex-wrap: nowrap;
? ? align-items: center;
?
? ? .text {
? ? ? margin: 0 0.15rem;
? ? }
?
? ? .area-menu {
? ? ? position: relative;
? ? ? display: inline-block;
?
? ? ? .area-msg {
? ? ? ? width: 1.5rem;
? ? ? ? height: 0.56rem;
? ? ? ? line-height: 0.56rem;
? ? ? ? background-color: #fff;
? ? ? ? border: 1px solid #dcdcdc;
? ? ? ? border-radius: 0.1rem;
? ? ? ? text-align: center;
? ? ? ? overflow: hidden;
? ? ? }
?
? ? ? ul {
? ? ? ? position: absolute;
? ? ? ? top: 0.57rem;
? ? ? ? width: 160px;
? ? ? ? height: auto;
? ? ? ? max-height: 180px;
? ? ? ? font-size: 14px;
? ? ? ? overflow-y: scroll;
? ? ? ? background-color: #fff;
? ? ? ? border: 1px solid #ddd;
? ? ? ? border-radius: 4px;
?
? ? ? ? li {
? ? ? ? ? text-align: center;
? ? ? ? ? height: 30px;
? ? ? ? ? line-height: 30px;
? ? ? ? }
? ? ? }
? ? }
? }
?
</style>

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Vue.js組件使用props傳遞數(shù)據(jù)的方法

    Vue.js組件使用props傳遞數(shù)據(jù)的方法

    這篇文章主要為大家詳細(xì)介紹了Vue.js組件使用props傳遞數(shù)據(jù)的方法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-10-10
  • Vue之Computed依賴收集與更新原理分析

    Vue之Computed依賴收集與更新原理分析

    這篇文章主要介紹了Vue之Computed依賴收集與更新原理分析,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-11-11
  • Vue 3集成??礧eb插件實(shí)現(xiàn)視頻監(jiān)控功能

    Vue 3集成??礧eb插件實(shí)現(xiàn)視頻監(jiān)控功能

    本文詳細(xì)介紹了如何使用 Vue 3 框架集成??礧eb插件實(shí)現(xiàn)視頻監(jiān)控功能,通過定義屬性、事件、變量,以及編寫初始化、播放視頻、處理節(jié)點(diǎn)點(diǎn)擊事件等方法,我們成功實(shí)現(xiàn)了視頻監(jiān)控系統(tǒng)的前端部分,感興趣的朋友一起看看吧
    2024-11-11
  • 總結(jié)vue映射的方法與混入的使用過程

    總結(jié)vue映射的方法與混入的使用過程

    這篇文章主要介紹了總結(jié)vue映射的方法與混入的使用過程,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-04-04
  • vue多環(huán)境配置之 .env配置文件詳解

    vue多環(huán)境配置之 .env配置文件詳解

    .env文件是vue運(yùn)行項(xiàng)目時的環(huán)境配置文件,這篇文章主要介紹了vue多環(huán)境配置之 .env配置文件,需要的朋友可以參考下
    2023-03-03
  • vue-cli3.0 腳手架搭建項(xiàng)目的過程詳解

    vue-cli3.0 腳手架搭建項(xiàng)目的過程詳解

    這篇文章主要介紹了vue-cli3.0 腳手架搭建項(xiàng)目的過程,本文分步驟給大家介紹的非常詳細(xì),具有一定的參考借鑒價值,需要的朋友可以參考下
    2018-10-10
  • Vue.js之render函數(shù)使用詳解

    Vue.js之render函數(shù)使用詳解

    這篇文章主要介紹了Vue.js之render函數(shù)使用詳解,本篇文章通過簡要的案例,講解了該項(xiàng)技術(shù)的了解與使用,以下就是詳細(xì)內(nèi)容,需要的朋友可以參考下
    2021-09-09
  • Vue組件化學(xué)習(xí)之scoped詳解

    Vue組件化學(xué)習(xí)之scoped詳解

    這篇文章主要為大家詳細(xì)介紹了Vue組件化學(xué)習(xí)之scoped,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助
    2022-02-02
  • Nuxt使用Vuex的方法示例

    Nuxt使用Vuex的方法示例

    這篇文章主要介紹了Nuxt使用Vuex的方法示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-09-09
  • Vue+Openlayer實(shí)現(xiàn)圖形的拖動和旋轉(zhuǎn)變形效果

    Vue+Openlayer實(shí)現(xiàn)圖形的拖動和旋轉(zhuǎn)變形效果

    Openlayer具有自己的擴(kuò)展插件ol-ext,可以用來實(shí)現(xiàn)圖形的拖拽、旋轉(zhuǎn)、縮放、拉伸、移動等操作,本文將主要介紹通過Openlayer實(shí)現(xiàn)圖形的拖動和旋轉(zhuǎn),需要的同學(xué)可以學(xué)習(xí)一下
    2021-11-11

最新評論

湖南省| 德兴市| 南陵县| 衡山县| 图片| 右玉县| 房山区| 乌苏市| 调兵山市| 余姚市| 牡丹江市| 厦门市| 松江区| 大港区| 纳雍县| 洞头县| 灌南县| 南郑县| 将乐县| 茂名市| 香港 | 阳西县| 凌源市| 精河县| 海盐县| 正定县| 台北县| 建昌县| 彩票| 凤庆县| 原平市| 阿拉善盟| 平安县| 萝北县| 池州市| 南通市| 天柱县| 嘉祥县| 宣城市| 潮州市| 大化|