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

refactor(directive): v-html

上级 be734f3d
...@@ -135,6 +135,18 @@ ...@@ -135,6 +135,18 @@
"navigationBarTitleText": "keep-alive 组合式 API" "navigationBarTitleText": "keep-alive 组合式 API"
} }
}, },
{
"path": "pages/directive/v-html/v-html-options",
"style": {
"navigationBarTitleText": "v-html 选项式 API"
}
},
{
"path": "pages/directive/v-html/v-html-composition",
"style": {
"navigationBarTitleText": "v-html 组合式 API"
}
},
{ {
"path": "pages/directive/v-bind/v-bind", "path": "pages/directive/v-bind/v-bind",
"style": { "style": {
...@@ -271,12 +283,6 @@ ...@@ -271,12 +283,6 @@
"navigationBarTitleText": "v-slot" "navigationBarTitleText": "v-slot"
} }
}, },
{
"path": "pages/directive/v-html/v-html",
"style": {
"navigationBarTitleText": "v-html"
}
},
{ {
"path": "pages/component-instance/slots/slots-options", "path": "pages/component-instance/slots/slots-options",
"style": { "style": {
......
<template>
<view v-html="html" />
</template>
<script setup lang="uts">
const html = '<p class="p" style="color: red;">hello world for composition API!</p>'
</script>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
export default { export default {
data() { data() {
return { return {
html: '<p class="p" style="color: red;">hello world!</p>' html: '<p class="p" style="color: red;">hello world for options API!</p>'
} }
} }
} }
......
const PAGE_PATH = '/pages/directive/v-html/v-html' const OPTIONS_PAGE_PATH = '/pages/directive/v-html/v-html-options'
const COMPOSITION_PAGE_PATH = '/pages/directive/v-html/v-html-composition'
// TODO: ios 暂不支持
describe('v-html', () => { describe('v-html', () => {
let page let page
beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor('view')
})
it('basic', async () => {
// 补充延迟确保渲染完成
await page.waitFor(500)
const test = async () => {
const image = await program.screenshot() const image = await program.screenshot()
expect(image).toMatchImageSnapshot() expect(image).toMatchImageSnapshot()
}
it('v-html options API', async () => {
page = await program.reLaunch(OPTIONS_PAGE_PATH)
await page.waitFor(700)
await test(page)
})
it('v-html composition API', async () => {
page = await program.reLaunch(COMPOSITION_PAGE_PATH)
await page.waitFor(700)
await test(page)
}) })
}) })
\ No newline at end of file
...@@ -630,6 +630,28 @@ export default { ...@@ -630,6 +630,28 @@ export default {
] ]
} }
] as Page[] ] as Page[]
},
{
id: 'directive',
name: '指令',
pages: [
{
id: 'v-html',
name: 'v-html',
children: [
{
id: 'v-html-options',
name: 'v-html 选项式 API',
url: 'v-html-options'
},
{
id: 'v-html-composition',
name: 'v-html 组合式 API',
url: 'v-html-composition'
},
]
}
]
}, },
{ {
id: 'lifecycle', id: 'lifecycle',
......
...@@ -153,17 +153,19 @@ function transform(fileInfo, api) { ...@@ -153,17 +153,19 @@ function transform(fileInfo, api) {
## directives ## directives
- [ ] v-bind v-bind - [x] v-html
- [ ] v-for v-for - [ ] v-show
- [ ] v-if v-if - [ ] v-if v-else-if v-else
- [ ] v-model defineModel - [ ] v-for
- [ ] v-on v-on - [ ] v-on
- [ ] v-show v-show - [ ] v-bind
- [ ] v-slot v-slot - [ ] v-model
- [ ] v-once v-once - [ ] v-slot
- [ ] v-memo v-memo - [ ] v-pre
- [ ] v-pre v-pre - [ ] v-once
- [ ] v-html v-html - [ ] v-memo
- [ ] v-text
- [ ] -cloak
## lifecycle ## lifecycle
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册