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

fix(mp-weixin): input event of the textarea does not trigger on iOS (#3090)

上级 35485d6c
......@@ -17,6 +17,36 @@ describe('mp-weixin: transform component', () => {
code,
`(_ctx, _cache) => {
return {}
}`
)
})
test('lazy element: textarea', () => {
assert(
`<textarea></textarea>`,
`<textarea></textarea>`,
`(_ctx, _cache) => {
return {}
}`
)
assert(
`<textarea @input="input"></textarea>`,
`<block wx:if="{{r0}}"><textarea bindinput="{{a}}"></textarea></block>`,
`(_ctx, _cache) => {
return { a: _o(_ctx.input) }
}`
)
assert(
`<textarea v-model="text"></textarea>`,
`<block wx:if="{{r0}}"><textarea value="{{a}}" bindinput="{{b}}"></textarea></block>`,
`(_ctx, _cache) => {
return { a: _ctx.text, b: _o($event => _ctx.text = $event.detail.value) }
}`
)
assert(
`<textarea v-if="ok1" @input="input"/><textarea v-else-if="ok2"/><textarea v-else @input="input"/>`,
`<textarea wx:if="{{a}}" bindinput="{{b}}"/><textarea wx:elif="{{c}}"/><block wx:else><textarea wx:if="{{r0}}" bindinput="{{d}}"/></block>`,
`(_ctx, _cache) => {
return _e({ a: _ctx.ok1 }, _ctx.ok1 ? { b: _o(_ctx.input) } : _ctx.ok2 ? {} : { d: _o(_ctx.input) }, { c: _ctx.ok2 })
}`
)
})
......
......@@ -80,6 +80,8 @@ const miniProgram = {
lazyElement: {
canvas: [{ name: 'bind', arg: ['canvas-id', 'id'] }],
editor: [{ name: 'on', arg: ['ready'] }],
// iOS 平台需要延迟
textarea: [{ name: 'on', arg: ['input'] }],
},
component: {
dir: COMPONENTS_DIR,
......
......@@ -36,6 +36,8 @@ export const miniProgram: MiniProgramCompilerOptions = {
lazyElement: {
canvas: [{ name: 'bind', arg: ['canvas-id', 'id'] }],
editor: [{ name: 'on', arg: ['ready'] }],
// iOS 平台需要延迟
textarea: [{ name: 'on', arg: ['input'] }],
},
component: {
dir: COMPONENTS_DIR,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册