提交 ac36a3e5 编写于 作者: fxy060608's avatar fxy060608

fix(mp-weixin): scroll-view with drag event (#3921)

上级 93e977db
......@@ -188,6 +188,43 @@ describe('mp-weixin: transform component', () => {
`<canvas wx:if="{{a}}" canvas-id="{{b}}"/><canvas wx:elif="{{c}}"/><block wx:else><canvas wx:if="{{r0}}" canvas-id="{{d}}"/></block>`,
`(_ctx, _cache) => {
return _e({ a: _ctx.ok1 }, _ctx.ok1 ? { b: _ctx.id } : _ctx.ok2 ? {} : { d: _ctx.id }, { c: _ctx.ok2 })
}`
)
})
test('lazy element: scroll-view', () => {
assert(
`<scroll-view/>`,
`<scroll-view/>`,
`(_ctx, _cache) => {
return {}
}`
)
assert(
`<scroll-view @dragstart="d"/>`,
`<block wx:if="{{r0}}"><scroll-view binddragstart="{{a}}"/></block>`,
`(_ctx, _cache) => {
return { a: _o(_ctx.d) }
}`
)
assert(
`<scroll-view @dragging="d"/>`,
`<block wx:if="{{r0}}"><scroll-view binddragging="{{a}}"/></block>`,
`(_ctx, _cache) => {
return { a: _o(_ctx.d) }
}`
)
assert(
`<scroll-view @dragend="d"/>`,
`<block wx:if="{{r0}}"><scroll-view binddragend="{{a}}"/></block>`,
`(_ctx, _cache) => {
return { a: _o(_ctx.d) }
}`
)
assert(
`<scroll-view @dragstart="d" @dragging="d" @dragend="d"/>`,
`<block wx:if="{{r0}}"><scroll-view binddragstart="{{a}}" binddragging="{{b}}" binddragend="{{c}}"/></block>`,
`(_ctx, _cache) => {
return { a: _o(_ctx.d), b: _o(_ctx.d), c: _o(_ctx.d) }
}`
)
})
......
......@@ -52,6 +52,12 @@ export const miniProgram: MiniProgramCompilerOptions = {
arg: ['ready'],
},
],
'scroll-view': [
{
name: 'on',
arg: ['dragstart', 'dragging', 'dragend'],
},
],
// iOS 平台需要延迟
input: [{ name: 'bind', arg: ['type'] }],
textarea: [{ name: 'on', arg: ['input'] }],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册