Commit e73d7072 by MichaelJier

fix

1. tab栏优化:标签不滚动时均匀分布
parent d8e1f3b6
...@@ -66,8 +66,8 @@ export default { ...@@ -66,8 +66,8 @@ export default {
}); });
if (res.code === 200 && res.errorCode === 0) { if (res.code === 200 && res.errorCode === 0) {
this.wechatInfo = res.data || {}; this.wechatInfo = res.data || {};
this.isScroll()
this.$nextTick(() => { this.$nextTick(() => {
this.isScroll()
this.listScroll() this.listScroll()
this.boxScrollListener() this.boxScrollListener()
}) })
...@@ -94,11 +94,18 @@ export default { ...@@ -94,11 +94,18 @@ export default {
isScroll() { isScroll() {
const boxScroll = this.$refs.boxScroll const boxScroll = this.$refs.boxScroll
const fatherWidth = boxScroll.clientWidth const fatherWidth = boxScroll.clientWidth
const childWidth = boxScroll.getElementsByClassName('list')[0].clientWidth const list = boxScroll.getElementsByClassName('list')[0]
const childWidth = list.clientWidth
if (fatherWidth > childWidth) { if (fatherWidth > childWidth) {
for (const item of boxScroll.getElementsByClassName('item')) { for (const item of boxScroll.getElementsByClassName('item')) {
item.style['max-width'] = 'none' item.style['max-width'] = 'none'
} }
list.style.width = '100%'
list.style.display = 'flex'
list.style['justify-content'] = 'space-around'
} else {
list.style.width = 'fit-content'
list.style.display = 'block'
} }
}, },
boxScrollListener() { boxScrollListener() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment