Skip to content

Commit ea956bc

Browse files
committed
test(runtime-dom): 打包测试区分style 和 class属性
1 parent 50bf14f commit ea956bc

File tree

2 files changed

+58
-42
lines changed

2 files changed

+58
-42
lines changed

packages/vue/example/HelloVue/App.js

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,35 @@ import { h, reactive, ref, effect, stop } from '../../lib/vue3.esm.js'
22

33
export default {
44
render() {
5-
return h('div', {
6-
id: 'root',
7-
class: ['flex', 'container-r'],
8-
onClick: this.aclick
9-
}, [
10-
h('p', { class: 'red' }, 'hello'),
11-
h('p', { class: 'blue' }, ` ${this.wei.age}`),
12-
])
5+
return h(
6+
'div',
7+
{
8+
id: 'root',
9+
class: ['flex', 'container-r'],
10+
onClick: this.aclick
11+
},
12+
[
13+
h('p', { class: 'red' }, 'hello'),
14+
h(
15+
'p',
16+
{
17+
class: 'blue',
18+
style: {
19+
color: 'red',
20+
background: 'aqua'
21+
}
22+
},
23+
` ${this.wei.age}`
24+
)
25+
]
26+
)
1327
},
1428
setup() {
1529
// 返回对象或者h()渲染函数
1630
let wei = reactive({
1731
age: 18
1832
})
19-
let age;
33+
let age
2034
const runner = effect(() => {
2135
age = wei.age
2236
})
@@ -28,7 +42,6 @@ export default {
2842
// console.log(wei.age);
2943
// console.log(age);
3044
stop(runner)
31-
3245
}
3346

3447
return {
@@ -38,4 +51,3 @@ export default {
3851
}
3952
}
4053
}
41-
Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8" />
5-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Document</title>
8-
</head>
9-
<style>
10-
.red {
11-
width: 100px;
12-
color: red;
13-
background-color: aqua;
14-
}
15-
.blue {
16-
width: 100px;
17-
color: blue;
18-
background-color: aqua;
19-
}
20-
.flex {
21-
display: flex;
22-
}
23-
.container-r {
24-
flex-flow: row nowrap;
25-
justify-content: space-between;
26-
align-items: center;
27-
}
28-
</style>
29-
<body>
30-
<div id="app"></div>
31-
<script src="./main.js" type="module"></script>
32-
</body>
33-
</html>
3+
4+
<head>
5+
<meta charset="UTF-8" />
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8+
<title>Document</title>
9+
</head>
10+
<style>
11+
.red {
12+
width: 100px;
13+
color: red;
14+
background-color: aqua;
15+
}
16+
17+
.blue {
18+
width: 100px;
19+
}
20+
21+
.flex {
22+
display: flex;
23+
}
24+
25+
.container-r {
26+
flex-flow: row nowrap;
27+
justify-content: space-between;
28+
align-items: center;
29+
}
30+
</style>
31+
32+
<body>
33+
<div id="app"></div>
34+
<script src="./main.js" type="module"></script>
35+
</body>
36+
37+
</html>

0 commit comments

Comments
 (0)