|
@@ -352,13 +352,7 @@ export default {
|
|
|
moveTheCityContainer (e) {
|
|
|
const selectList = this.$refs.selectList
|
|
|
const cityList = this.$refs.cityList
|
|
|
- const { lineFirstDom, insetedLine, tolerance, clickLine } = this.getDomInfo(e.target)
|
|
|
- // 如果页面上cityList插入中间(除了插入到末尾),则都会产生误差,所以需要根据情况减去其高度
|
|
|
- let correct = cityList.getBoundingClientRect().height
|
|
|
- // (最后一行/和上次点击的是同一行)则不减去correct
|
|
|
- if (insetedLine === 0 || insetedLine === tolerance.length || insetedLine === clickLine) {
|
|
|
- correct = 0
|
|
|
- }
|
|
|
+ const { lineFirstDom, clickLine } = this.getDomInfo(e.target)
|
|
|
|
|
|
if (clickLine >= lineFirstDom.length) {
|
|
|
selectList.appendChild(cityList) // 往列表末尾插入元素
|
|
@@ -369,6 +363,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 1. 获取每行的第一个dom
|
|
|
+ // 2. 获取每个元素距离顶部高度数组
|
|
|
+ // 3. 获取行间距差值
|
|
|
+ // 4. 当前点击的哪一行
|
|
|
+ // 5. 点击按钮前cityList在哪一行
|
|
|
getDomInfo (dom) {
|
|
|
if (this.selectorType !== 'line') return
|
|
|
const indexDOMList = [] // 所有索引项dom数组(索引项下有每个省份的按钮)
|
|
@@ -670,7 +668,6 @@ export default {
|
|
|
})
|
|
|
count = selectedCityArr.length
|
|
|
}
|
|
|
-
|
|
|
if (this.expandedProvince.selectedState !== 'checked' && cityLength !== 0 && count === 0) {
|
|
|
return
|
|
|
}
|
|
@@ -680,6 +677,7 @@ export default {
|
|
|
const res = this.provinceListMap[key].find(item => {
|
|
|
if (item.name === this.expandedProvince.name) {
|
|
|
Object.assign(item, this.expandedProvince)
|
|
|
+ this.provinceListMap['#'][0].selectedState = ''
|
|
|
}
|
|
|
return item.name === this.expandedProvince.name
|
|
|
})
|