Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
380ce2ef
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
398
Star
3
Fork
10
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello-uvue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
380ce2ef
编写于
3月 31, 2025
作者:
F
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增setup非响应式数据绑定style测试例 #16699
上级
09f691c2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
3 deletion
+50
-3
pages/directive/v-bind/v-bind-composition.uvue
pages/directive/v-bind/v-bind-composition.uvue
+24
-1
pages/directive/v-bind/v-bind-options.uvue
pages/directive/v-bind/v-bind-options.uvue
+21
-1
pages/directive/v-bind/v-bind.test.js
pages/directive/v-bind/v-bind.test.js
+5
-1
未找到文件。
pages/directive/v-bind/v-bind-composition.uvue
浏览文件 @
380ce2ef
...
@@ -22,6 +22,13 @@
...
@@ -22,6 +22,13 @@
<view>bind arr style</view>
<view>bind arr style</view>
<view class="my-10">{{ dataInfo.backgroundColor }}</view>
<view class="my-10">{{ dataInfo.backgroundColor }}</view>
<view>{{ dataInfo.border }}</view>
<view>{{ dataInfo.border }}</view>
</view>
<view class="mb-10 p-10">
<text id="bind-raw-object-style" :style="rawObjectStyle">rawObjectStyle</text>
</view>
<!-- 目前仅android平台在内部重新调用了normalizeStyle,其他端暂时没有,这应该是vue的bug -->
<view class="mb-10 p-10">
<text id="bind-raw-array-style" :style="rawArrayStyle">rawArrayStyle</text>
</view>
</view>
<!-- v-bind props -->
<!-- v-bind props -->
...
@@ -82,7 +89,23 @@
...
@@ -82,7 +89,23 @@
const fooProps = reactive({
const fooProps = reactive({
title: 'foo title(json)',
title: 'foo title(json)',
num: 2,
num: 2,
})
})
const rawObjectStyle = {
width: '100%',
height: '30px',
'background-color': 'red'
}
const rawArrayStyle = [
{
width: '100%',
height: '30px'
},
{
'background-color': 'red'
}
]
defineExpose({
defineExpose({
dataInfo
dataInfo
...
...
pages/directive/v-bind/v-bind-options.uvue
浏览文件 @
380ce2ef
...
@@ -18,6 +18,12 @@
...
@@ -18,6 +18,12 @@
<view>bind arr style</view>
<view>bind arr style</view>
<view class="my-10">{{ dataInfo.backgroundColor }}</view>
<view class="my-10">{{ dataInfo.backgroundColor }}</view>
<view>{{ dataInfo.border }}</view>
<view>{{ dataInfo.border }}</view>
</view>
<view class="mb-10 p-10">
<text id="bind-raw-object-style" :style="rawObjectStyle">rawObjectStyle</text>
</view>
<view class="mb-10 p-10">
<text id="bind-raw-array-style" :style="rawArrayStyle">rawArrayStyle</text>
</view>
</view>
<!-- v-bind props -->
<!-- v-bind props -->
...
@@ -85,7 +91,21 @@
...
@@ -85,7 +91,21 @@
fooProps:{
fooProps:{
title: 'foo title(json)',
title: 'foo title(json)',
num: 2,
num: 2,
}
},
rawObjectStyle: {
width: '100%',
height: '30px',
'background-color': 'red'
},
rawArrayStyle: [
{
width: '100%',
height: '30px'
},
{
'background-color': 'red'
}
]
}
}
}
}
}
}
...
...
pages/directive/v-bind/v-bind.test.js
浏览文件 @
380ce2ef
...
@@ -66,7 +66,11 @@ describe('v-bind', () => {
...
@@ -66,7 +66,11 @@ describe('v-bind', () => {
const
vBindCss
=
await
page
.
$
(
'
.v-bind-css
'
)
const
vBindCss
=
await
page
.
$
(
'
.v-bind-css
'
)
expect
(
await
vBindCss
.
style
(
'
backgroundColor
'
)).
toBe
(
'
rgb(255, 0, 0)
'
)
expect
(
await
vBindCss
.
style
(
'
backgroundColor
'
)).
toBe
(
'
rgb(255, 0, 0)
'
)
expect
(
await
vBindCss
.
style
(
'
height
'
)).
toBe
(
'
150px
'
)
expect
(
await
vBindCss
.
style
(
'
height
'
)).
toBe
(
'
150px
'
)
}
}
const
bindRawObjectStyle
=
await
page
.
$
(
'
#bind-raw-object-style
'
)
expect
(
await
bindRawObjectStyle
.
text
()).
toBe
(
"
rawObjectStyle
"
)
const
bindRawArrayStyle
=
await
page
.
$
(
'
#bind-raw-array-style
'
)
expect
(
await
bindRawArrayStyle
.
text
()).
toBe
(
"
rawArrayStyle
"
)
}
}
it
(
'
v-bind options API
'
,
async
()
=>
{
it
(
'
v-bind options API
'
,
async
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录