Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

动态变更scrollable时好像不能及时响应 #134

Open
ZHT131 opened this issue May 13, 2024 · 1 comment
Open

动态变更scrollable时好像不能及时响应 #134

ZHT131 opened this issue May 13, 2024 · 1 comment

Comments

@ZHT131
Copy link

ZHT131 commented May 13, 2024

编译平台
HbuilderX

VUE版本
vue3

运行平台
H5

z-paging版本
最新版

问题描述
我在页面中使用了拖动排序功能,但是当我在触发拖拽时更改scrollable视图没有及时阻止滚动,也就是当我拖拽时还能同时触发页面滚动

var el = document.getElementById('componentList')
				if (el) {
					const sortable = Sortable.create(el, {
						group: 'draggable-component',
						animation: 200,
						forceFallback: false,
						// 开始拖拽的时候
						onStart: function (event: any) {
							//禁止z-paging滚动
							scrollable.value = false
							console.log(scrollable.value)
						},
						// 结束拖拽
						onEnd: (event: any) => {
							const component = decorateStore.data[event.oldIndex!]
							decorateStore.data.splice(event.oldIndex!, 1)
							decorateStore.data.splice(event.newIndex!, 0, component)
							nextTick(() => {
								sortable.sort(range(decorateStore.data.length).map((value: any) => value.toString()))
							})
							//发送消息
							decorateStore.postMessage({
								type: 'sort',
								oldIndex: event.oldIndex,
								newIndex: event.newIndex,
							})
							//解除禁止滚动
							scrollable.value = true
						},
					})
				}
@SmileZXLee
Copy link
Owner

可否在demo基础上修改,提供一个可复现的demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants