From 9022b1b2ff0132121c60d67c655f82bd0eb11f5d Mon Sep 17 00:00:00 2001 From: fxy060608 <153647646@qq.com> Date: Fri, 26 Jul 2024 13:33:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20v-for=20=E5=A2=9E=E5=8A=A0=20JSON.parse?= =?UTF-8?q?=20=E7=9A=84number=E7=B1=BB=E5=9E=8B=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/directive/v-for/v-for-composition.uvue | 8 +++++++- pages/directive/v-for/v-for-options.uvue | 7 ++++++- pages/directive/v-for/v-for.test.js | 8 ++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/pages/directive/v-for/v-for-composition.uvue b/pages/directive/v-for/v-for-composition.uvue index 584564b..966a3aa 100644 --- a/pages/directive/v-for/v-for-composition.uvue +++ b/pages/directive/v-for/v-for-composition.uvue @@ -6,6 +6,10 @@ v-for number {{ item }} + + + + {{ item }} v-for object @@ -144,5 +148,7 @@ const mapList = new Map([ const setList = new Set(['set value 1', 'set value 2', 'set value 3']) -const utsJSONObject = reactive({ utsKey1: 'UTSJSONObject-value1', utsKey2: 'UTSJSONObject-value2', utsKey3: 'UTSJSONObject-value3' }) +const utsJSONObject = reactive({ utsKey1: 'UTSJSONObject-value1', utsKey2: 'UTSJSONObject-value2', utsKey3: 'UTSJSONObject-value3' }) + +const utsNumber = JSON.parse("3") as number diff --git a/pages/directive/v-for/v-for-options.uvue b/pages/directive/v-for/v-for-options.uvue index 37b0446..8880d42 100644 --- a/pages/directive/v-for/v-for-options.uvue +++ b/pages/directive/v-for/v-for-options.uvue @@ -6,6 +6,10 @@ v-for number {{ item }} + + + + {{ item }} v-for object @@ -144,7 +148,8 @@ export default { ['map-key-3', 'map value 3'], ]), setList: new Set(['set value 1', 'set value 2', 'set value 3']), - utsJSONObject: { utsKey1: 'UTSJSONObject-value1', utsKey2: 'UTSJSONObject-value2', utsKey3: 'UTSJSONObject-value3' } + utsJSONObject: { utsKey1: 'UTSJSONObject-value1', utsKey2: 'UTSJSONObject-value2', utsKey3: 'UTSJSONObject-value3' }, + utsNumber: JSON.parse("3") as number } } } diff --git a/pages/directive/v-for/v-for.test.js b/pages/directive/v-for/v-for.test.js index 8672925..213901f 100644 --- a/pages/directive/v-for/v-for.test.js +++ b/pages/directive/v-for/v-for.test.js @@ -12,6 +12,14 @@ describe('v-for', () => { expect(await num2.text()).toBe('2') const num3 = await page.$('#number-3') expect(await num3.text()).toBe('3') + + // v-for uts-number + const utsNum1 = await page.$('#uts-number-1') + expect(await utsNum1.text()).toBe('1') + const utsNum2 = await page.$('#uts-number-2') + expect(await utsNum2.text()).toBe('2') + const utsNum3 = await page.$('#uts-number-3') + expect(await utsNum3.text()).toBe('3') // v-for object const value1 = await page.$('#value1') -- GitLab