diff --git a/packages/uni-mp-weixin/__tests__/component.spec.ts b/packages/uni-mp-weixin/__tests__/component.spec.ts index 50c613f3f0dd8b4d110ceae197941d7a24651e7f..ea825c47e57f1c7f3468d71a5ada1b63541a9d4e 100644 --- a/packages/uni-mp-weixin/__tests__/component.spec.ts +++ b/packages/uni-mp-weixin/__tests__/component.spec.ts @@ -188,6 +188,43 @@ describe('mp-weixin: transform component', () => { ``, `(_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( + ``, + ``, + `(_ctx, _cache) => { + return {} +}` + ) + assert( + ``, + ``, + `(_ctx, _cache) => { + return { a: _o(_ctx.d) } +}` + ) + assert( + ``, + ``, + `(_ctx, _cache) => { + return { a: _o(_ctx.d) } +}` + ) + assert( + ``, + ``, + `(_ctx, _cache) => { + return { a: _o(_ctx.d) } +}` + ) + assert( + ``, + ``, + `(_ctx, _cache) => { + return { a: _o(_ctx.d), b: _o(_ctx.d), c: _o(_ctx.d) } }` ) }) diff --git a/packages/uni-mp-weixin/src/compiler/options.ts b/packages/uni-mp-weixin/src/compiler/options.ts index 06e45436becc4562299aa3a2df8f3e5a7c40b5db..31918355f56d848a0258e45aa345dfe939b1f770 100644 --- a/packages/uni-mp-weixin/src/compiler/options.ts +++ b/packages/uni-mp-weixin/src/compiler/options.ts @@ -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'] }],