feat(MineTask): 添加问卷滑动切换功能
- 在 QuestionList 组件中添加 slideChange 事件监听 - 在 MineTask 组件中实现 slideChange 方法,调整滑动后问卷区域高度 -通过自定义事件和回调函数实现问卷页滑动切换时的高度自适应
This commit is contained in:
@@ -24,6 +24,15 @@ watch(
|
||||
}, 500);
|
||||
}
|
||||
);
|
||||
function slideChange() {
|
||||
console.log(1);
|
||||
setTimeout(() => {
|
||||
console.log(swiper.value.$el.style.height);
|
||||
// 获取高度
|
||||
swiper.value.$el.style.height = questionComat.value[active.value].$el.scrollHeight + 30 + 'px';
|
||||
swiper.value.resize();
|
||||
}, 500);
|
||||
}
|
||||
function handleDragEnd() {
|
||||
isDrag.value = false;
|
||||
// setTimeout(() => {
|
||||
@@ -52,6 +61,8 @@ function handleDragEnd() {
|
||||
<van-swipe :loop="false" @drag-start="handleDragStart" @drag-end="handleDragEnd" ref="swiper">
|
||||
<van-swipe-item v-for="question in surveys" :key="question?.sn">
|
||||
<question-list
|
||||
@slideChange="slideChange"
|
||||
:parentRef="swiper"
|
||||
:survey="question"
|
||||
style="max-width: 100vw; overflow: hidden"
|
||||
ref="questionComat"
|
||||
|
||||
Reference in New Issue
Block a user