Skip to content

Commit 492bf30

Browse files
committed
update: 优化 subnvue 示例的样式
1 parent 5f41851 commit 492bf30

5 files changed

Lines changed: 40 additions & 28 deletions

File tree

‎pages/API/subnvue/drawer.nvue‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<text style="color: #8f8f94; margin-bottom: 40px;">左侧列表</text>
44
<list style="height: 450px;">
55
<cell v-for="item in lists" :key="item.id">
6-
<div class="text-wrapper">
6+
<div class="text-wrapper" @click="clickitem(item.id)">
77
<text style="font-size: 30px; ">{{item.name}}</text>
88
<text class="icon">&#xe583;</text>
99
</div>
@@ -42,7 +42,11 @@
4242
methods: {
4343
hideDrawer() {
4444
uni.getSubNVueById('drawer').hide('auto')
45-
}
45+
},
46+
clickitem(e) {
47+
const subNVue = uni.getSubNVueById('drawer')
48+
subNVue.postMessage(e);
49+
}
4650
}
4751
}
4852
</script>

‎pages/API/subnvue/nav.nvue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<style>
3232
.wrapper {
33-
background-image: linear-gradient(to right, #e498e1, #e60000);
33+
background-image: linear-gradient(to right, #a80077, #66ff00);
3434
flex-direction: column;
3535
}
3636
.status-bar {

‎pages/API/subnvue/popup.nvue‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<text class="content">{{content}}</text>
77
</div>
88
<div>
9-
<text style="color: red; font-size: 44px;">以下为 Popup 内部滚动示例:</text>
9+
<text style="color: red; font-size: 30px;">以下为 Popup 内部滚动示例:</text>
1010
</div>
1111
<div class="cell" v-for="(item, index) in lists" @click="handle(item)" :key="index">
1212
<text class="text">{{item}}</text>
@@ -72,7 +72,7 @@
7272
border-bottom-width: 1px;
7373
border-bottom-color: #CBCBCB;
7474
flex: none;
75-
font-size: 40px;
75+
font-size: 30px;
7676
}
7777
.scroller {
7878
flex: 1;
@@ -90,7 +90,7 @@
9090
align-items: flex-end;
9191
}
9292
.send-message {
93-
font-size: 35px;
93+
font-size: 30px;
9494
line-height: 80px;
9595
color: #00CE47;
9696
margin-left: 20px;
@@ -106,7 +106,7 @@
106106
background-color: #5989B9;
107107
}
108108
.text {
109-
font-size: 40px;
109+
font-size: 30px;
110110
text-align: center;
111111
color: white;
112112
}

‎pages/API/subnvue/subnvue.vue‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
break;
4747
}
4848
});
49+
const drawerNVue = uni.getSubNVueById('drawer');
50+
drawerNVue.onMessage((res) => {
51+
let data = res.data;
52+
uni.showToast({
53+
title: '点击了第' + data + '项',
54+
icon:"none"
55+
});
56+
});
4957
},
5058
methods: {
5159
showDrawer() {
@@ -55,9 +63,9 @@
5563
const subNVue = uni.getSubNVueById('popup')
5664
subNVue.postMessage({
5765
title: '请阅读软件内容',
58-
content: 'uni-app 是一个使用 Vue.js 开发跨平台应用的前端框架,开发者编写一套代码,可编译到iOS、Android、H5、小程序等多个平台。uni-app是对vue语法支持度最高的跨端框架。uni-app App端内置 weex 引擎,提供了原生渲染能力。uni-app App 端内置 HTML5+ 引擎,让 js 可以直接调用丰富的原生能力。'
66+
content: 'uni-app 是一个使用 Vue.js 开发跨平台应用的前端框架,开发者编写一套代码,可编译到iOS、Android、H5、小程序等多个平台。'
5967
});
60-
subNVue.show('fade-in', 200)
68+
subNVue.show('slide-in-top', 250)
6169
},
6270
videoErrorCallback: function(e) {
6371
uni.showModal({
@@ -91,18 +99,18 @@
9199
background-color: #F4F5F6;
92100
}
93101
.example {
94-
padding: 0 30upx 30upx
102+
padding: 0 10px 10px
95103
}
96104
.example-title {
97-
font-size: 32upx;
98-
line-height: 32upx;
105+
font-size: 14px;
106+
line-height: 14px;
99107
color: #777;
100-
margin: 40upx 25upx;
108+
margin: 40px 2upx;
101109
position: relative
102110
}
103111
video {
104112
position: absolute;
105-
bottom: 10px;
113+
bottom: 30px;
106114
left: 0;
107115
width: 100%;
108116
height: 200px;

‎pages/API/subnvue/video-mask.nvue‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717
interval: null,
1818
yourTexts: [
1919
{
20-
name: '张三',
21-
content: 'uni-app 是一个使用 Vue.js 开发跨平台应用的前端框架',
20+
name: '学员A',
21+
content: '老师讲的真好',
2222
}, {
23-
name: '周周',
24-
content: '开发者编写一套代码,可编译到iOS、Android、H5、小程序等多个平台。',
23+
name: '学员B',
24+
content: 'uni-app值得学习',
2525
}, {
26-
name: '李四',
27-
content: 'uni-app是对vue语法支持度最高的跨端框架。',
26+
name: '学员C',
27+
content: '老师,还有实战例子吗?',
2828
}, {
29-
name: '王五',
30-
content: 'uni-app App端内置 weex 引擎,提供了原生渲染能力。',
29+
name: '学员D',
30+
content: '老师,请问是不是要先学会vue才能学uni-app?',
3131
}, {
32-
name: '刘六',
33-
content: 'uni-app App 端内置 HTML5+ 引擎,让 js 可以直接调用丰富的原生能力。',
32+
name: '学员E',
33+
content: '受教了,uni-app太牛了',
3434
}
3535
],
3636
}
@@ -53,8 +53,8 @@
5353
addItem() {
5454
const vm = this;
5555
vm.lists = [{
56-
name: '刘六',
57-
content: 'uni-app App 端内置 HTML5+ 引擎,让 js 可以直接调用丰富的原生能力。',
56+
name: '学员E',
57+
content: '受教了,uni-app太牛了',
5858
}];
5959
const dom = weex.requireModule('dom')
6060
vm.interval = setInterval(() => {
@@ -100,13 +100,13 @@
100100
}
101101
.name {
102102
flex: none;
103-
font-size: 30px;
103+
font-size: 20px;
104104
margin-right: 20px;
105105
color: #FF5A5F;
106106
}
107107
.content {
108108
flex: 1;
109-
font-size: 30px;
109+
font-size: 20px;
110110
color: #F4F5F6;
111111
}
112112
</style>

0 commit comments

Comments
 (0)