diff --git a/pages/directive/v-bind/v-bind-composition.uvue b/pages/directive/v-bind/v-bind-composition.uvue index 22056b518c70e01d953510587a3b16c925d7ef92..169c8116633f50e6f3a7bd85f0f8cf3835b0ccec 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 6e5687bd12e1cdf5373e6cc651bbc0fca08917c3..99dd8692f7df9fea7c0bde90f55b30f672f0de06 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 9143567e32805bd63a3e60595fc319c2486ee5a7..fd266ec6f1f7177bcfe97e4dd6119a9d6161f33b 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') } }