提交 52c485c7 编写于 作者: H hdx

feat(v-for): 新增 UTSJSONObject

上级 549e944a
...@@ -77,6 +77,15 @@ ...@@ -77,6 +77,15 @@
<view class="mb-10" v-for="(item, index) in setList" :key="index"> <view class="mb-10" v-for="(item, index) in setList" :key="index">
<text :id="`set-value-${index + 1}`">{{ item }}</text> <text :id="`set-value-${index + 1}`">{{ item }}</text>
</view>
<view class="bold mb-10">v-for UTSJSONObject</view>
<view
v-for="(value, key) in utsJSONObject"
:key="key"
class="mb-10 flex justify-between flex-row">
<text :id="key">{{ key }}</text>
<text :id="value">{{ value }}</text>
</view> </view>
</view> </view>
<!-- #ifdef APP --> <!-- #ifdef APP -->
...@@ -133,5 +142,7 @@ const mapList = new Map<string, string>([ ...@@ -133,5 +142,7 @@ const mapList = new Map<string, string>([
['map-key-3', 'map value 3'], ['map-key-3', 'map value 3'],
]) ])
const setList = new Set<string>(['set value 1', 'set value 2', 'set value 3']) const setList = new Set<string>(['set value 1', 'set value 2', 'set value 3'])
const utsJSONObject = reactive({ utsKey1: 'UTSJSONObject-value1', utsKey2: 'UTSJSONObject-value2', utsKey3: 'UTSJSONObject-value3' })
</script> </script>
...@@ -77,6 +77,15 @@ ...@@ -77,6 +77,15 @@
<view class="mb-10" v-for="(item, index) in setList" :key="index"> <view class="mb-10" v-for="(item, index) in setList" :key="index">
<text :id="`set-value-${index + 1}`">{{ item }}</text> <text :id="`set-value-${index + 1}`">{{ item }}</text>
</view>
<view class="bold mb-10">v-for UTSJSONObject</view>
<view
v-for="(value, key) in utsJSONObject"
:key="key"
class="mb-10 flex justify-between flex-row">
<text :id="key">{{ key }}</text>
<text :id="value">{{ value }}</text>
</view> </view>
</view> </view>
<!-- #ifdef APP --> <!-- #ifdef APP -->
...@@ -134,7 +143,8 @@ export default { ...@@ -134,7 +143,8 @@ export default {
['map-key-2', 'map value 2'], ['map-key-2', 'map value 2'],
['map-key-3', 'map value 3'], ['map-key-3', 'map value 3'],
]), ]),
setList: new Set<string>(['set value 1', 'set value 2', 'set value 3']), setList: new Set<string>(['set value 1', 'set value 2', 'set value 3']),
utsJSONObject: { utsKey1: 'UTSJSONObject-value1', utsKey2: 'UTSJSONObject-value2', utsKey3: 'UTSJSONObject-value3' }
} }
} }
} }
......
...@@ -46,9 +46,19 @@ describe('v-for', () => { ...@@ -46,9 +46,19 @@ describe('v-for', () => {
expect(await setValue2.text()).toBe('set value 2') expect(await setValue2.text()).toBe('set value 2')
const setValue3 = await page.$('#set-value-3') const setValue3 = await page.$('#set-value-3')
expect(await setValue3.text()).toBe('set value 3') expect(await setValue3.text()).toBe('set value 3')
// v-for UTSJSONObject
for (let i = 1; i <= 3; i++) {
/// key
let utsKey = await page.$('#utsKey' + i)
expect(await utsKey.text()).toBe('utsKey' + i)
/// value
let utsValue = await page.$('#UTSJSONObject-value' + i)
expect(await utsValue.text()).toBe('UTSJSONObject-value' + i)
}
await page.waitFor(500) await page.waitFor(500)
const image = await program.screenshot({ const image = await program.screenshot({
fullPage: true fullPage: true
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册