vue移动端JAVA城市三级联动_前端开发用Vue.js来实现城市三级联动

/p>

<

.selBoxList {

width: 100%;

margin-top: 50px;

text-align: center;

}

.selBoxList .selSt {

min-width: 100px;

display: inline-block;

position: relative;

;

}

.selBoxList .selSt .current {

width: 100%;

padding: 0 10px;

font-size: 16px;

line-height: 30px;

cursor: pointer;

float: left;

border: 1px solid #ccc;

background: #fff;

box-sizing: border-box;

position: relative;

z-index: 2;

}

.selBoxList .selSt .box {

width: 100%;

position: absolute;

left: 0;

top: 30px;

border: 1px solid #ccc;

max-height: 300px;

overflow: auto;

box-sizing: border-box;

}

.selBoxList .selSt .box span {

width: 100%;

font-size: 16px;

line-height: 30px;

cursor: pointer;

border-top: 1px solid #ccc;

float: left;

}

.selBoxList .selSt .box span:hover {

background: #f1f1f1;

}

–请选择–{{cityArr[proIndex].name}}

{{cityArr[n].name}}

–请选择–{{cityArr[proIndex].sub[cityIndex].name}}

{{cityArr[proIndex].sub[n].name}}

–请选择–{{cityArr[proIndex].sub[cityIndex].sub[areaIndex].name}}

@click=”setOption(‘areaIndex’, $index)”>{{cityArr[proIndex].sub[cityIndex].sub[n].name}}

var vm = new Vue({

el: ‘body’,

data: {

cityArr: arrCity,

proIndex: 0,

cityIndex: 0,

areaIndex: 0,

showSelect: ”

},

methods: {

setOption: function (type, index) {

this[type] = index;

if (type === ‘proIndex’) {

this.cityIndex = 0;

this.areaIndex = 0;

}

if (type === ‘cityIndex’) {

this.areaIndex = 0;

}

this.showSelect = ”;

},

toggleSelect: function (n) {

if (this.showSelect === n) {

this.showSelect = ”;

} else {

this.showSelect = n;

}

}

}

})

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值