From b11a004bead720189f1d3230000925553ca99553 Mon Sep 17 00:00:00 2001
From: zhenyuWang <13641039885@163.com>
Date: Thu, 18 Jan 2024 15:53:57 +0800
Subject: [PATCH] feat(composition api): useAttrs
---
.../composition-api/basic/use-attrs/Foo.uvue | 19 ++++++++++++++++
.../basic/use-attrs/use-attrs.test.js | 22 +++++++++++++++++++
.../basic/use-attrs/use-attrs.uvue | 9 ++++++--
pages/tab-bar/composition-api.uvue | 2 +-
4 files changed, 49 insertions(+), 3 deletions(-)
create mode 100644 pages/composition-api/basic/use-attrs/Foo.uvue
create mode 100644 pages/composition-api/basic/use-attrs/use-attrs.test.js
diff --git a/pages/composition-api/basic/use-attrs/Foo.uvue b/pages/composition-api/basic/use-attrs/Foo.uvue
new file mode 100644
index 0000000..657c3fa
--- /dev/null
+++ b/pages/composition-api/basic/use-attrs/Foo.uvue
@@ -0,0 +1,19 @@
+
+
+ attrs.class: {{attrs['class']}}
+ attrs.msg: {{attrs['msg']}}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/composition-api/basic/use-attrs/use-attrs.test.js b/pages/composition-api/basic/use-attrs/use-attrs.test.js
new file mode 100644
index 0000000..4b2575e
--- /dev/null
+++ b/pages/composition-api/basic/use-attrs/use-attrs.test.js
@@ -0,0 +1,22 @@
+const PAGE_PATH = '/pages/composition-api/basic/use-attrs/use-attrs'
+
+describe('useAttrs', () => {
+ if (process.env.uniTestPlatformInfo.startsWith('android')) {
+ let page = null
+ beforeAll(async () => {
+ page = await program.reLaunch(PAGE_PATH)
+ await page.waitFor('view')
+ })
+ it('basic', async () => {
+ const attrsClass = await page.$('#attrs-class')
+ expect(await attrsClass.text()).toBe('attrs.class: foo')
+
+ const attrsMsg = await page.$('#attrs-msg')
+ expect(await attrsMsg.text()).toBe('attrs.msg: msg')
+ })
+ } else {
+ it('other platform', () => {
+ expect(1).toBe(1)
+ })
+ }
+})
\ No newline at end of file
diff --git a/pages/composition-api/basic/use-attrs/use-attrs.uvue b/pages/composition-api/basic/use-attrs/use-attrs.uvue
index 69a33ac..6ce3ead 100644
--- a/pages/composition-api/basic/use-attrs/use-attrs.uvue
+++ b/pages/composition-api/basic/use-attrs/use-attrs.uvue
@@ -1,5 +1,10 @@
- useAttrs
+
+
+
+
-
+
\ No newline at end of file
diff --git a/pages/tab-bar/composition-api.uvue b/pages/tab-bar/composition-api.uvue
index 4e9f5ad..91019ee 100644
--- a/pages/tab-bar/composition-api.uvue
+++ b/pages/tab-bar/composition-api.uvue
@@ -80,7 +80,7 @@
{
name: 'useAttrs',
url: 'use-attrs',
- enable: false,
+ enable: true,
},
] as PageItem[],
}, {
--
GitLab