Skip to content

Commit

Permalink
fix(TabScroll): 修复错误 `TypeError: Cannot read properties of undefined …
Browse files Browse the repository at this point in the history
…(reading 'clientWidth')`

#131
  • Loading branch information
bhuh12 committed Nov 5, 2021
1 parent b87c00f commit 910733c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/components/TabScroll.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ export default {
methods: {
// 更新滚动数据
update() {
const { clientWidth, scrollWidth, scrollLeft } = this.$refs.container
const { container } = this.$refs
if (!container) return
const { clientWidth, scrollWidth, scrollLeft } = container
// 判断是否移动端
// userAgent 中包含 mobile 字段,或者浏览器滚动条宽度为 0
Expand Down

0 comments on commit 910733c

Please sign in to comment.