vant icon indicating copy to clipboard operation
vant copied to clipboard

van-tabs swipeable开启后,使用van-action-sheet页面出现异常

Open chenxi5211993 opened this issue 4 years ago • 5 comments

重现链接

https://codesandbox.io/s/vant-3-issue-template-forked-36cj73?file=/src/App.vue

Vant 版本

3.6.2

描述一下你遇到的问题。

van-tabs swipeable开启后,使用van-action-sheet页面出现异常

重现步骤

van-tabs swipeable开启后,在tab中使用van-action-sheet组件,van-action-sheet为true时,左右滑动tabs,页面出现异常

设备/浏览器

所有设备

chenxi5211993 avatar Sep 14 '22 04:09 chenxi5211993

语法错误:data() should return an object.

data() {
  active: 0;
  show: false;
}

更改为:

data() {
  return {
    active: 0,
    show: false
  }
}

wjw-gavin avatar Sep 14 '22 05:09 wjw-gavin

语法错误:data() should return an object.

data() {
  active: 0;
  show: false;
}

更改为:

data() {
  return {
    active: 0,
    show: false
  }
}

哦哦,抱歉,已修改

chenxi5211993 avatar Sep 14 '22 05:09 chenxi5211993

语法错误:data() should return an object.

data() {
  active: 0;
  show: false;
}

更改为:

data() {
  return {
    active: 0,
    show: false
  }
}

哦哦,抱歉,已修改

更改后使用是否还有问题呢?

wjw-gavin avatar Sep 14 '22 05:09 wjw-gavin

语法错误:data() should return an object.

data() {
  active: 0;
  show: false;
}

更改为:

data() {
  return {
    active: 0,
    show: false
  }
}

哦哦,抱歉,已修改

更改后使用是否还有问题呢?

还是有问题的

chenxi5211993 avatar Sep 14 '22 06:09 chenxi5211993

看了下,找到问题的原因,应该是存在父级元素有使用 transform,从而导致定位 position: fixed 会根据该父元素定位,而非浏览器窗口。 解决方法:建议把 van-action-sheet 放到 van-tabs 的外面使用,并且我个人认为这样做才是更合理的。

image

wjw-gavin avatar Sep 14 '22 06:09 wjw-gavin