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

refactor(directive): v-text

上级 c678b400
......@@ -227,6 +227,20 @@
}
},
// #endif
// #ifdef WEB
{
"path": "pages/directive/v-text/v-text-options",
"style": {
"navigationBarTitleText": "v-text 选项式 API"
}
},
{
"path": "pages/directive/v-text/v-text-composition",
"style": {
"navigationBarTitleText": "v-text 组合式 API"
}
},
// #endif
{
......
<template>
<view class="page">
<view class="flex flex-row justify-between mb-10">
<text>v-txt for text:</text>
<text id="v-text-text" v-text="vTextForText"></text>
</view>
<view class="flex flex-row justify-between mb-10">
<text>v-txt for view:</text>
<view id="v-text-view" v-text="vTextForView"></view>
</view>
</view>
</template>
<script setup lang="uts">
const vTextForText = ref('v-text for text')
const vTextForView = ref('v-text for view')
</script>
<template>
<view class="page">
<view class="flex flex-row justify-between mb-10">
<text>v-txt for text:</text>
<text id="v-text-text" v-text="vTextForText"></text>
</view>
<view class="flex flex-row justify-between mb-10">
<text>v-txt for view:</text>
<view id="v-text-view" v-text="vTextForView"></view>
</view>
</view>
</template>
<script lang="uts">
export default {
data() {
return {
vTextForText: 'v-text for text',
vTextForView: 'v-text for view',
}
}
}
</script>
const OPTIONS_PAGE_PATH = '/pages/directive/v-text/v-text-options'
const COMPOSITION_PAGE_PATH = '/pages/directive/v-text/v-text-composition'
describe('v-text', () => {
if (!process.env.uniTestPlatformInfo.startsWith('web')) {
// TODO: 仅 web 支持
it('web', async () => {
expect(1).toBe(1)
})
return
}
let page
const test = async (pagePath) => {
page = await program.reLaunch(pagePath)
await page.waitFor('view')
const vTextText = await page.$('#v-text-text')
expect(await vTextText.text()).toBe('v-text for text')
const vTextView = await page.$('#v-text-view')
expect(await vTextView.text()).toBe('v-text for view')
}
it('v-text options API', async () => {
await test(OPTIONS_PAGE_PATH)
})
it('v-text composition API', async () => {
await test(COMPOSITION_PAGE_PATH)
})
})
......@@ -768,6 +768,28 @@ export default {
},
]
},
{
id: 'v-text',
name: 'v-text',
children: [
{
id: 'v-text-options',
name: 'v-text 选项式 API',
url: 'v-text-options',
// #ifdef APP
enable: false
// #endif
},
{
id: 'v-text-composition',
name: 'v-text 组合式 API',
url: 'v-text-composition',
// #ifdef APP
enable: false
// #endif
},
]
},
]
},
{
......
......@@ -164,7 +164,7 @@ function transform(fileInfo, api) {
- [x] v-pre
- [x] v-once
- [x] v-memo
- [ ] v-text 暂不支持
- [x] v-text
- [ ] v-cloak 暂不支持
## lifecycle
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册