提交 061cb81a 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

refactor(render function): render

上级 d507a19b
......@@ -985,7 +985,7 @@ export default {
{
id: 'render-composition',
name: 'render 组合式 API',
// #ifdef APP-IOS
// #ifdef APP-ANDROID
enable: false,
// #endif
url: 'render-composition'
......
<script setup lang="uts">
import CompForHFunction from '@/components/CompForHFunction.uvue'
defineOptions({
data() {
return {
msg: 'default msg'
}
},
render(): VNode {
const instance = getCurrentInstance()!.proxy!
const msg = ref('default msg')
return h('view', { class: 'page' }, [
const render = ():VNode => h('view', { class: 'page' }, [
h(CompForHFunction, {}, (): VNode[] => [h('text', { class: 'comp-slot' }, 'component slot')]),
h('text', { class: 'uni-common-mt msg', style: { color: 'blue' } }, instance.$data['msg']),
h('text', { class: 'uni-common-mt msg', style: { color: 'blue' } }, msg.value),
h(
'button',
{
class: 'uni-common-mt btn',
type: 'primary',
onClick: () => {
instance.$data['msg'] = 'new msg'
msg.value = 'new msg'
}
},
'click'
)
])
}
})
])
</script>
<template><render /></template>
<style>
.btn {
color: red;
......
......@@ -4,7 +4,7 @@ const COMPOSITION_PAGE_PATH = '/pages/render-function/render/render-composition'
describe('render-function render', () => {
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isWeb = platformInfo.startsWith('web')
const isIos = platformInfo.startsWith('ios')
const isAndroid = platformInfo.startsWith('android')
if (isWeb) {
it("web platform test cannot get render dom", async () => {
expect(1).toBe(1);
......@@ -38,10 +38,10 @@ describe('render-function render', () => {
})
it('render composition API', async () => {
if (!isIos) {
if (!isAndroid) {
await test(COMPOSITION_PAGE_PATH)
} else {
// TODO: ios 端 defineOptions + render 页面空白
// TODO: android 端 报错 java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
expect(1).toBe(1);
}
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册