diff --git a/components/CompForHFunction.uvue b/components/CompForHFunction.uvue index 7f3a7f28907c6f9b4e1dd665fec43e274549eb56..916e5748ffe50efd4bbd37acea4bb047427bba84 100644 --- a/components/CompForHFunction.uvue +++ b/components/CompForHFunction.uvue @@ -1,6 +1,17 @@ - + + + diff --git a/pages/render-function/render/render-composition.uvue b/pages/render-function/render/render-composition.uvue index 9ca0d350c6de0ff0c78c4656a6ab9d8a6bec21f4..d8732fca07699ede9ae38e9013a44403414786f6 100644 --- a/pages/render-function/render/render-composition.uvue +++ b/pages/render-function/render/render-composition.uvue @@ -5,7 +5,7 @@ const msg = ref('default msg') // 故意外部声明为UTSJSONObject const msgProps = { class: 'uni-common-mt msg', style: { color: 'blue' } } const render = ():VNode => h('view', { class: 'page' }, [ - h(CompForHFunction, {}, (): VNode[] => [h('text', { class: 'comp-slot' }, 'component slot')]), + h(CompForHFunction, { msg: msg.value }, (): VNode[] => [h('text', { class: 'comp-slot' }, 'component slot')]), h('text', msgProps, msg.value), h( 'button', diff --git a/pages/render-function/render/render-options.uvue b/pages/render-function/render/render-options.uvue index 8fae540c57d34798c771e509275795dc311d143c..6f4fef69c27351c07f4c328232cfdfa7cf1682d6 100644 --- a/pages/render-function/render/render-options.uvue +++ b/pages/render-function/render/render-options.uvue @@ -1,35 +1,35 @@ - - - \ No newline at end of file diff --git a/pages/render-function/render/render.test.js b/pages/render-function/render/render.test.js index 1dc30f8208e1ba8027b5b0e37f2334ff817807f4..dd9ed10f9a223618d69f5370c84ab577e8c23cd0 100644 --- a/pages/render-function/render/render.test.js +++ b/pages/render-function/render/render.test.js @@ -25,12 +25,16 @@ describe('render-function render', () => { let msgEl = await page.$('.msg') expect(await msgEl.text()).toEqual('default msg') + compForHFunctionMsg = await page.$('#comp-for-h-function-msg') + expect(await compForHFunctionMsg.text()).toEqual('default msg') const btnEl = await page.$('.btn') expect(await btnEl.property('type')).toBe('primary') await btnEl.tap() msgEl = await page.$('.msg') expect(await msgEl.text()).toEqual('new msg') + compForHFunctionMsg = await page.$('#comp-for-h-function-msg') + expect(await compForHFunctionMsg.text()).toEqual('new msg') } it('render options API', async () => {