Skip to content

Commit a7a7b2b

Browse files
authored
Merge pull request dcloudio#3 from xiaoyucoding/master
refactor: 支持编译到支付宝小程序及百度小程序
2 parents 550bc1b + 56b4fc3 commit a7a7b2b

31 files changed

Lines changed: 408 additions & 454 deletions

File tree

‎App.vue‎

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,80 @@
11
<script>
22
export default {
3-
onLaunch: function () {
3+
onLaunch: function() {
44
console.log('App Launch');
5-
//#ifdef APP-PLUS
6-
/* 5+环境锁定屏幕方向 */
5+
// #ifdef APP-PLUS
6+
// 锁定屏幕方向
77
plus.screen.lockOrientation('portrait-primary'); //锁定
8-
/* 5+环境升级提示 */
9-
var server = "https://uniapp.dcloud.io/update"; //检查更新地址
10-
var req = { //升级检测数据
11-
"appid": plus.runtime.appid,
12-
"version": plus.runtime.version,
13-
"imei": plus.device.imei
14-
};
8+
// 检测升级
159
uni.request({
16-
url: server,
17-
data: req,
10+
url: 'https://uniapp.dcloud.io/update', //检查更新的服务器地址
11+
data: {
12+
appid: plus.runtime.appid,
13+
version: plus.runtime.version,
14+
imei: plus.device.imei
15+
},
1816
success: (res) => {
19-
console.log("success", res);
17+
console.log('success', res);
2018
if (res.statusCode == 200 && res.data.isUpdate) {
2119
let openUrl = plus.os.name === 'iOS' ? res.data.iOS : res.data.Android;
22-
uni.showModal({ //提醒用户更新
20+
// 提醒用户更新
21+
uni.showModal({
2322
title: '更新提示',
2423
content: res.data.note ? res.data.note : '是否选择更新',
25-
success: (res) => {
26-
if (res.confirm) {
24+
success: (showResult) => {
25+
if (showResult.confirm) {
2726
plus.runtime.openURL(openUrl);
2827
}
2928
}
3029
})
3130
}
3231
}
3332
})
34-
//#endif
33+
// #endif
3534
},
36-
onShow: function () {
35+
onShow: function() {
3736
console.log('App Show')
3837
},
39-
onHide: function () {
38+
onHide: function() {
4039
console.log('App Hide')
4140
}
4241
}
4342
</script>
43+
4444
<style>
4545
/* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
46-
@import "./common/uni.css";
47-
46+
@import './common/uni.css';
47+
4848
/* 以下样式用于 hello uni-app 演示所需 */
4949
page {
50-
background-color:#F4F5F6;
50+
background-color: #F4F5F6;
5151
height: 100%;
52-
font-size:28upx;
52+
font-size: 28upx;
5353
line-height: 1.8;
5454
}
55-
.uni-header-logo{
56-
padding:30upx;
57-
text-align:center;
58-
margin-top:10upx;
55+
56+
.uni-header-logo {
57+
padding: 30upx;
58+
text-align: center;
59+
margin-top: 10upx;
5960
}
60-
.uni-header-logo image{
61+
62+
.uni-header-logo image {
6163
width: 140upx;
6264
height: 140upx;
6365
}
64-
.uni-hello-text{
65-
color:#7A7E83;
66+
67+
.uni-hello-text {
68+
color: #7A7E83;
6669
}
67-
.uni-hello-addfile{
68-
text-align:center;
69-
line-height:300upx;
70-
background:#FFF;
71-
padding:50upx;
72-
margin-top:10px;
73-
font-size:38upx;
74-
color:#808080;
70+
71+
.uni-hello-addfile {
72+
text-align: center;
73+
line-height: 300upx;
74+
background: #FFF;
75+
padding: 50upx;
76+
margin-top: 10px;
77+
font-size: 38upx;
78+
color: #808080;
7579
}
76-
</style>
80+
</style>

‎common/uni.css‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -354,19 +354,19 @@ radio-group label, checkbox-group label{
354354
right: 0;
355355
bottom: 0;
356356
left: 0;
357-
height: 1upx;
357+
height: 1px;
358358
content: '';
359359
-webkit-transform: scaleY(.5);
360360
transform: scaleY(.5);
361361
background-color: #c8c7cc;
362362
}
363-
.uni-list:before {
363+
.uni-list::before {
364364
position: absolute;
365365
z-index: 10;
366366
right: 0;
367367
top: 0;
368368
left: 0;
369-
height: 1upx;
369+
height: 1px;
370370
content: '';
371371
-webkit-transform: scaleY(.5);
372372
transform: scaleY(.5);
@@ -393,22 +393,22 @@ radio-group label, checkbox-group label{
393393
.uni-list-cell-right {
394394
flex: 1;
395395
}
396-
.uni-list-cell:after {
396+
.uni-list-cell::after {
397397
position: absolute;
398398
z-index: 3;
399399
right: 0;
400400
bottom: 0;
401401
left: 30upx;
402-
height: 1upx;
402+
height: 1px;
403403
content: '';
404404
-webkit-transform: scaleY(.5);
405405
transform: scaleY(.5);
406406
background-color: #c8c7cc;
407407
}
408-
.uni-list .uni-list-cell:last-child:after {
408+
.uni-list .uni-list-cell:last-child::after {
409409
height: 0upx;
410410
}
411-
.uni-list-cell-last.uni-list-cell:after {
411+
.uni-list-cell-last.uni-list-cell::after {
412412
height: 0upx;
413413
}
414414
.uni-list-cell-divider {
@@ -418,23 +418,23 @@ radio-group label, checkbox-group label{
418418
background-color: #f7f7f7;
419419
padding:15upx 20upx;
420420
}
421-
.uni-list-cell-divider:before {
421+
.uni-list-cell-divider::before {
422422
position: absolute;
423423
right: 0;
424424
top: 0;
425-
left: 0upx;
426-
height: 1upx;
425+
left: 0;
426+
height: 1px;
427427
content: '';
428428
-webkit-transform: scaleY(.5);
429429
transform: scaleY(.5);
430430
background-color: #c8c7cc;
431431
}
432-
.uni-list-cell-divider:after {
432+
.uni-list-cell-divider::after {
433433
position: absolute;
434434
right: 0;
435435
bottom: 0;
436436
left: 0upx;
437-
height: 1upx;
437+
height: 1px;
438438
content: '';
439439
-webkit-transform: scaleY(.5);
440440
transform: scaleY(.5);
@@ -478,7 +478,7 @@ radio-group label, checkbox-group label{
478478
-webkit-transform: translateY(-50%);
479479
transform: translateY(-50%);
480480
}
481-
.uni-list-cell-navigate.uni-navigate-bottom.uni-active:after {
481+
.uni-list-cell-navigate.uni-navigate-bottom.uni-active::after {
482482
font-family: uniicons;
483483
content: '\e580';
484484
position: absolute;
@@ -502,7 +502,7 @@ radio-group label, checkbox-group label{
502502
.uni-collapse .uni-list-cell {
503503
padding-left: 20upx;
504504
}
505-
.uni-collapse .uni-list-cell:after {
505+
.uni-collapse .uni-list-cell::after {
506506
left: 52upx;
507507
}
508508
.uni-list.uni-active {

‎components/echarts/echarts.simple.min.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎components/mpvue-echarts/src/echarts.vue‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export default {
4545
default: false,
4646
},
4747
},
48-
onReady() {
48+
// #ifdef H5
49+
mounted() {
4950
if (!this.echarts) {
5051
console.warn('组件需绑定 echarts 变量,例:<ec-canvas id="mychart-dom-bar" '
5152
+ 'canvas-id="mychart-bar" :echarts="echarts"></ec-canvas>');
@@ -54,18 +55,20 @@ export default {
5455
5556
if (!this.lazyLoad) this.init();
5657
},
58+
// #endif
59+
// #ifndef H5
60+
onReady() {
61+
if (!this.echarts) {
62+
console.warn('组件需绑定 echarts 变量,例:<ec-canvas id="mychart-dom-bar" '
63+
+ 'canvas-id="mychart-bar" :echarts="echarts"></ec-canvas>');
64+
return;
65+
}
66+
67+
if (!this.lazyLoad) this.init();
68+
},
69+
// #endif
5770
methods: {
5871
init() {
59-
const version = wx.version.version.split('.').map(n => parseInt(n, 10));
60-
const isValid = version[0] > 1 || (version[0] === 1 && version[1] > 9)
61-
|| (version[0] === 1 && version[1] === 9 && version[2] >= 91);
62-
if (!isValid) {
63-
console.error('微信基础库版本过低,需大于等于 1.9.91。'
64-
+ '参见:https://github.com/ecomfe/echarts-for-weixin'
65-
+ '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82');
66-
return;
67-
}
68-
6972
if (!this.onInit) {
7073
console.warn('请传入 onInit 函数进行初始化');
7174
return;

‎main.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Vue.prototype.$backgroundAudioData = {
1515
formatedPlayTime: '00:00:00'
1616
}
1717

18-
Vue.component('page-head',pageHead)
19-
Vue.component('page-foot',pageFoot)
18+
Vue.component('page-head', pageHead)
19+
Vue.component('page-foot', pageFoot)
2020

2121

2222
App.mpType = 'app'

0 commit comments

Comments
 (0)