Skip to content

Commit 92669cb

Browse files
committed
1. 优化样式,避免在nvue报错
2. 修复popup在头条小程序上底部有缺失的问题,同时连带使用了popup的keyborad和picker,calendar等组件的问题 3. 修复form组件在头条小程序上的报错问题
1 parent a2acf7e commit 92669cb

File tree

39 files changed

+223
-98
lines changed

39 files changed

+223
-98
lines changed

manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@
120120
"appid" : "17597421"
121121
},
122122
"mp-toutiao" : {
123-
"usingComponents" : true
123+
"usingComponents" : true,
124+
"appid" : "tt2bc55d78b4ff50bf"
124125
},
125126
"h5" : {
126127
"template" : "template.h5.html",

pages.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -846,20 +846,20 @@
846846
"borderStyle": "black",
847847
"list": [{
848848
"pagePath": "pages/example/components",
849-
// "iconPath": "static/uview/example/component.png",
850-
// "selectedIconPath": "static/uview/example/component_select.png",
849+
"iconPath": "static/uview/example/component.png",
850+
"selectedIconPath": "static/uview/example/component_select.png",
851851
"text": "组件"
852852
},
853853
{
854854
"pagePath": "pages/example/js",
855-
// "iconPath": "static/uview/example/js.png",
856-
// "selectedIconPath": "static/uview/example/js_select.png",
855+
"iconPath": "static/uview/example/js.png",
856+
"selectedIconPath": "static/uview/example/js_select.png",
857857
"text": "工具"
858858
},
859859
{
860860
"pagePath": "pages/example/template",
861-
// "iconPath": "static/uview/example/template.png",
862-
// "selectedIconPath": "static/uview/example/template_select.png",
861+
"iconPath": "static/uview/example/template.png",
862+
"selectedIconPath": "static/uview/example/template_select.png",
863863
"text": "模板"
864864
}
865865
]

pages/example/components.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</u-cell-group>
1111
</view>
1212
<u-gap height="70"></u-gap>
13-
<u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar>
13+
<!-- <u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar> -->
1414
</view>
1515
</template>
1616

pages/example/js.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</u-cell-group>
1111
</view>
1212
<u-gap height="70"></u-gap>
13-
<u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar>
13+
<!-- <u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar> -->
1414
</view>
1515
</template>
1616

pages/example/template.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</u-cell-group>
1111
</view>
1212
<u-gap height="70"></u-gap>
13-
<u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar>
13+
<!-- <u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar> -->
1414
</view>
1515
</template>
1616

uview-ui/components/u-avatar/u-avatar.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@
182182
@import "../../libs/css/style.components.scss";
183183
184184
.u-avatar {
185-
display: inline-flex;
185+
/* #ifndef APP-NVUE */
186+
display: inline-flex;
187+
/* #endif */
186188
align-items: center;
187189
justify-content: center;
188190
font-size: 28rpx;

uview-ui/components/u-button/u-button.vue

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
'u-btn--' + type,
1212
disabled ? `u-btn--${type}--disabled` : '',
1313
]"
14+
:hover-start-time="Number(hoverStartTime)"
15+
:hover-stay-time="Number(hoverStayTime)"
1416
:disabled="disabled"
1517
:form-type="formType"
1618
:open-type="openType"
@@ -211,7 +213,17 @@ export default {
211213
throttleTime: {
212214
type: [String, Number],
213215
default: 1000
214-
}
216+
},
217+
// 按住后多久出现点击态,单位毫秒
218+
hoverStartTime: {
219+
type: [String, Number],
220+
default: 20
221+
},
222+
// 手指松开后点击态保留时间,单位毫秒
223+
hoverStayTime: {
224+
type: [String, Number],
225+
default: 150
226+
},
215227
},
216228
computed: {
217229
// 当没有传bgColor变量时,按钮按下去的颜色类名
@@ -339,7 +351,9 @@ export default {
339351
position: relative;
340352
border: 0;
341353
//border-radius: 10rpx;
342-
display: inline-block;
354+
/* #ifndef APP-NVUE */
355+
display: inline-flex;
356+
/* #endif */
343357
// 避免边框某些场景可能被“裁剪”,不能设置为hidden
344358
overflow: visible;
345359
line-height: 1;
@@ -497,7 +511,9 @@ export default {
497511
}
498512
499513
.u-size-medium {
500-
display: inline-flex;
514+
/* #ifndef APP-NVUE */
515+
display: inline-flex;
516+
/* #endif */
501517
width: auto;
502518
font-size: 26rpx;
503519
height: 70rpx;
@@ -506,7 +522,9 @@ export default {
506522
}
507523
508524
.u-size-mini {
509-
display: inline-flex;
525+
/* #ifndef APP-NVUE */
526+
display: inline-flex;
527+
/* #endif */
510528
width: auto;
511529
font-size: 22rpx;
512530
padding-top: 1px;

uview-ui/components/u-calendar/u-calendar.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,6 @@
568568
569569
&__inner {
570570
height: 84rpx;
571-
display: -webkit-box;
572-
display: -webkit-flex;
573571
@include vue-flex;
574572
align-items: center;
575573
justify-content: center;

uview-ui/components/u-car-keyboard/u-car-keyboard.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@
186186
width: 62rpx;
187187
flex: 0 0 64rpx;
188188
height: 80rpx;
189-
display: inline-block;
189+
/* #ifndef APP-NVUE */
190+
display: inline-flex;
191+
/* #endif */
190192
font-size: 36rpx;
191193
text-align: center;
192194
line-height: 80rpx;

uview-ui/components/u-cell-item/u-cell-item.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<block class="u-cell__value" v-if="value">{{ value }}</block>
3636
<slot v-else></slot>
3737
</view>
38-
<view class="u-flex" v-if="$slots['right-icon']">
38+
<view class="u-flex u-cell_right" v-if="$slots['right-icon']">
3939
<slot name="right-icon"></slot>
4040
</view>
4141
<u-icon v-if="arrow" name="arrow-right" :style="[arrowStyle]" class="u-icon-wrap u-cell__right-icon-wrap"></u-icon>
@@ -249,7 +249,7 @@ export default {
249249
}
250250
251251
.u-cell-border:after {
252-
position: absolute;
252+
position: absolute;
253253
/* #ifndef APP-NVUE */
254254
box-sizing: border-box;
255255
content: ' ';
@@ -301,12 +301,16 @@ export default {
301301
302302
.u-cell--required:before {
303303
position: absolute;
304-
/* #ifndef APP-PLUS */
304+
/* #ifndef APP-NVUE */
305305
content: '*';
306306
/* #endif */
307307
left: 8px;
308308
margin-top: 4rpx;
309309
font-size: 14px;
310310
color: $u-type-error;
311311
}
312+
313+
.u-cell_right {
314+
line-height: 1;
315+
}
312316
</style>

uview-ui/components/u-checkbox-group/u-checkbox-group.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@
101101
})
102102
this.$emit('change', values);
103103
// 发出事件,用于在表单组件中嵌入checkbox的情况,进行验证
104-
this.$nextTick(() => {
104+
// 由于头条小程序执行迟钝,故需要用几十毫秒的延时
105+
setTimeout(() => {
105106
// 将当前的值发送到 u-form-item 进行校验
106107
this.dispatch('u-form-item', 'on-form-change', values);
107-
});
108+
}, 60)
108109
}
109110
}
110111
}
@@ -114,7 +115,7 @@
114115
@import "../../libs/css/style.components.scss";
115116
116117
.u-checkbox-group {
117-
/* #ifndef MP */
118+
/* #ifndef MP || APP-NVUE */
118119
display: inline-flex;
119120
flex-wrap: wrap;
120121
/* #endif */

uview-ui/components/u-checkbox/u-checkbox.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@
176176
name: this.name
177177
})
178178
// 执行父组件u-checkbox-group的事件方法
179-
if(this.parent && this.parent.emitEvent) this.parent.emitEvent();
179+
// 等待下一个周期再执行,因为this.$emit('input')作用于父组件,再反馈到子组件内部,需要时间
180+
setTimeout(() => {
181+
if(this.parent && this.parent.emitEvent) this.parent.emitEvent();
182+
}, 80);
180183
},
181184
// 设置input的值,这里通过input事件,设置通过v-model绑定的组件的值
182185
setValue() {
@@ -191,17 +194,11 @@
191194
// 如果原来为选中状态,那么可以取消
192195
if (this.value == true) {
193196
this.$emit('input', !this.value);
194-
// 等待下一个周期再执行,因为this.$emit('input')作用于父组件,再反馈到子组件内部,需要时间
195-
this.$nextTick(function() {
196-
this.emitEvent();
197-
})
197+
this.emitEvent();
198198
} else if ((this.parent && checkedNum < this.parent.max) || !this.parent) {
199199
// 如果原来为未选中状态,需要选中的数量少于父组件中设置的max值,才可以选中
200200
this.$emit('input', !this.value);
201-
// 等待下一个周期再执行,因为this.$emit('input')作用于父组件,再反馈到子组件内部,需要时间
202-
this.$nextTick(function() {
203-
this.emitEvent();
204-
})
201+
this.emitEvent();
205202
}
206203
207204
}

uview-ui/components/u-circle-progress/u-circle-progress.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ export default {
203203
@import "../../libs/css/style.components.scss";
204204
.u-circle-progress {
205205
position: relative;
206-
display: inline-flex;
206+
/* #ifndef APP-NVUE */
207+
display: inline-flex;
208+
/* #endif */
207209
align-items: center;
208210
justify-content: center;
209211
}

uview-ui/components/u-col/u-col.vue

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
alignItems: uAlignItem,
99
justifyContent: uJustify,
1010
textAlign: textAlign
11-
}" @tap.stop.prevent="click">
11+
}"
12+
@tap.stop.prevent="click">
1213
<slot></slot>
1314
</view>
1415
</template>
@@ -63,7 +64,7 @@
6364
mounted() {
6465
// 获取父组件实例,并赋值给对应的参数
6566
this.parent = this.$u.$parent.call(this, 'u-row');
66-
if(this.parent) {
67+
if (this.parent) {
6768
this.gutter = this.parent.gutter;
6869
}
6970
},
@@ -89,9 +90,62 @@
8990

9091
<style lang="scss">
9192
@import "../../libs/css/style.components.scss";
93+
9294
.u-col {
9395
/* #ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO */
9496
float: left;
9597
/* #endif */
9698
}
99+
100+
.u-col-0 {
101+
width: 0;
102+
}
103+
104+
.u-col-1 {
105+
width: calc(100%/12);
106+
}
107+
108+
.u-col-2 {
109+
width: calc(100%/12 * 2);
110+
}
111+
112+
.u-col-3 {
113+
width: calc(100%/12 * 3);
114+
}
115+
116+
.u-col-4 {
117+
width: calc(100%/12 * 4);
118+
}
119+
120+
.u-col-5 {
121+
width: calc(100%/12 * 5);
122+
}
123+
124+
.u-col-6 {
125+
width: calc(100%/12 * 6);
126+
}
127+
128+
.u-col-7 {
129+
width: calc(100%/12 * 7);
130+
}
131+
132+
.u-col-8 {
133+
width: calc(100%/12 * 8);
134+
}
135+
136+
.u-col-9 {
137+
width: calc(100%/12 * 9);
138+
}
139+
140+
.u-col-10 {
141+
width: calc(100%/12 * 10);
142+
}
143+
144+
.u-col-11 {
145+
width: calc(100%/12 * 11);
146+
}
147+
148+
.u-col-12 {
149+
width: calc(100%/12 * 12);
150+
}
97151
</style>

uview-ui/components/u-column-notice/u-column-notice.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,16 @@ export default {
222222
223223
.u-right-icon {
224224
margin-left: 12rpx;
225-
display: inline-flex;
225+
/* #ifndef APP-NVUE */
226+
display: inline-flex;
227+
/* #endif */
226228
align-items: center;
227229
}
228230
229231
.u-left-icon {
230-
display: inline-flex;
232+
/* #ifndef APP-NVUE */
233+
display: inline-flex;
234+
/* #endif */
231235
align-items: center;
232236
}
233237
</style>

uview-ui/components/u-count-down/u-count-down.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,9 @@ export default {
279279
@import "../../libs/css/style.components.scss";
280280
281281
.u-countdown {
282-
display: inline-flex;
282+
/* #ifndef APP-NVUE */
283+
display: inline-flex;
284+
/* #endif */
283285
align-items: center;
284286
}
285287

uview-ui/components/u-count-to/u-count-to.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ export default {
233233
@import "../../libs/css/style.components.scss";
234234
235235
.u-count-num {
236-
display: inline-block;
236+
/* #ifndef APP-NVUE */
237+
display: inline-flex;
238+
/* #endif */
237239
text-align: center;
238240
}
239241
</style>

uview-ui/components/u-divider/u-divider.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ export default {
146146
.u-divider-text {
147147
white-space: nowrap;
148148
padding: 0 16rpx;
149-
display: inline-flex;
149+
/* #ifndef APP-NVUE */
150+
display: inline-flex;
151+
/* #endif */
150152
}
151153
</style>

0 commit comments

Comments
 (0)