From a220bccb0f382ea7bb17c8a197418c84265b6603 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Tue, 7 May 2024 21:12:17 +0800 Subject: [PATCH] =?UTF-8?q?test(v-bind):=20=E5=A2=9E=E5=8A=A0=20css=20v-bi?= =?UTF-8?q?nd=20rpx=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/directive/v-bind/v-bind-composition.uvue | 4 +++- pages/directive/v-bind/v-bind-options.uvue | 6 ++++-- pages/directive/v-bind/v-bind.test.js | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pages/directive/v-bind/v-bind-composition.uvue b/pages/directive/v-bind/v-bind-composition.uvue index 22056b5..169c811 100644 --- a/pages/directive/v-bind/v-bind-composition.uvue +++ b/pages/directive/v-bind/v-bind-composition.uvue @@ -54,6 +54,7 @@ type DataInfo = { border : string fooProps : FooProps vBindClassBackgroundColor : string, + vBindClassRpxHeight : string, } const dataInfo = reactive({ @@ -68,6 +69,7 @@ const dataInfo = reactive({ } }, vBindClassBackgroundColor: 'red', + vBindClassRpxHeight: '300rpx' } as DataInfo) defineExpose({ @@ -79,7 +81,7 @@ defineExpose({ /* #ifdef WEB */ .v-bind-css { background-color: v-bind(dataInfo.vBindClassBackgroundColor); - height: 20px; + height: v-bind(dataInfo.vBindClassRpxHeight); } /* #endif */ diff --git a/pages/directive/v-bind/v-bind-options.uvue b/pages/directive/v-bind/v-bind-options.uvue index 6e5687b..99dd869 100644 --- a/pages/directive/v-bind/v-bind-options.uvue +++ b/pages/directive/v-bind/v-bind-options.uvue @@ -44,6 +44,7 @@ type DataInfo = { border: string fooProps: FooProps vBindClassBackgroundColor: string + vBindClassRpxHeight: string } export default { @@ -61,7 +62,8 @@ export default { name: 'foo obj name' } }, - vBindClassBackgroundColor: 'red' + vBindClassBackgroundColor: 'red', + vBindClassRpxHeight: '300rpx' } as DataInfo } } @@ -72,7 +74,7 @@ export default { /* #ifdef WEB */ .v-bind-css { background-color: v-bind(dataInfo.vBindClassBackgroundColor); - height: 20px; + height: v-bind(dataInfo.vBindClassRpxHeight); } /* #endif */ diff --git a/pages/directive/v-bind/v-bind.test.js b/pages/directive/v-bind/v-bind.test.js index 9143567..fd266ec 100644 --- a/pages/directive/v-bind/v-bind.test.js +++ b/pages/directive/v-bind/v-bind.test.js @@ -4,7 +4,6 @@ const COMPOSITION_PAGE_PATH = '/pages/directive/v-bind/v-bind-composition' describe('v-bind', () => { let page const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() - const isIos = platformInfo.startsWith('ios') const isWeb = platformInfo.startsWith('web') const isFirefox = platformInfo.indexOf('firefox') > -1 @@ -50,6 +49,7 @@ describe('v-bind', () => { if (isWeb) { const vBindCss = await page.$('.v-bind-css') expect(await vBindCss.style('backgroundColor')).toBe('rgb(255, 0, 0)') + expect(await vBindCss.style('height')).toBe('150px') } } -- GitLab