提交 a8583861 编写于 作者: Q qiang

Merge commit 'd26b2061'

...@@ -12,5 +12,5 @@ ...@@ -12,5 +12,5 @@
"message": "chore(release): publish %s" "message": "chore(release): publish %s"
} }
}, },
"version": "2.0.0-23020190919001" "version": "2.0.0-23220190921001"
} }
{ {
"name": "uniapp-js-framework", "name": "uniapp-js-framework",
"version": "0.0.1", "version": "0.0.1",
"scripts": { "scripts": {
"build:service:legacy": "npm run lint && rollup -c build/rollup.config.service.js", "build:service:legacy": "npm run lint && rollup -c build/rollup.config.service.js",
"lint": "eslint --fix --config package.json --ext .js --ext .vue --ignore-path .eslintignore build src", "lint": "eslint --fix --config package.json --ext .js --ext .vue --ignore-path .eslintignore build src",
"lint:cli": "eslint --fix --config package.json --ignore-path .eslintignore packages/uni-cli-shared packages/uni-template-compiler \"packages/vue-cli-*/**/*.js\" \"packages/webpack-uni-*/**/*.js\"", "lint:cli": "eslint --fix --config package.json --ignore-path .eslintignore packages/uni-cli-shared packages/uni-template-compiler \"packages/vue-cli-*/**/*.js\" \"packages/webpack-uni-*/**/*.js\"",
"dev:h5": "npm run lint && cross-env NODE_ENV=production UNI_WATCH=true UNI_PLATFORM=h5 node build/build.js", "dev:h5": "npm run lint && cross-env NODE_ENV=production UNI_WATCH=true UNI_PLATFORM=h5 node build/build.js",
"build:h5": "npm run lint && cross-env NODE_ENV=production UNI_WATCH=false UNI_PLATFORM=h5 node build/build.js", "build:h5": "npm run lint && cross-env NODE_ENV=production UNI_WATCH=false UNI_PLATFORM=h5 node build/build.js",
"build:h5:ui": "cross-env NODE_ENV=production UNI_WATCH=false UNI_PLATFORM=h5 UNI_UI=true node build/build.js", "build:h5:ui": "cross-env NODE_ENV=production UNI_WATCH=false UNI_PLATFORM=h5 UNI_UI=true node build/build.js",
"build:app-plus": "cross-env UNI_PLATFORM=app-plus rollup -c build/rollup.config.mp.js", "build:app-plus": "cross-env UNI_PLATFORM=app-plus rollup -c build/rollup.config.mp.js",
"build:app:all": "npm run lint && npm run build:app:nvue && npm run build:app:legacy", "build:app:all": "npm run lint && npm run build:app:nvue && npm run build:app:legacy",
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"test:cli": "cross-env NODE_ENV=test jest", "test:cli": "cross-env NODE_ENV=test jest",
"test:unit": "cross-env NODE_ENV=test UNI_PLATFORM=h5 mocha-webpack --require tests/unit/setup.js --webpack-config build/webpack.config.test.js tests/unit/**/*.spec.js", "test:unit": "cross-env NODE_ENV=test UNI_PLATFORM=h5 mocha-webpack --require tests/unit/setup.js --webpack-config build/webpack.config.test.js tests/unit/**/*.spec.js",
"release": "npm run lint:cli && lerna publish --force-publish=*", "release": "npm run lint:cli && lerna publish --force-publish=*",
"release:alpha": "npm run lint:cli && lerna publish --force-publish=* --npm-tag=alpha", "release:alpha": "npm run lint:cli && lerna publish --force-publish=* --npm-tag=alpha",
"release:next": "npm run lint:cli && lerna publish --force-publish=* --npm-tag=next" "release:next": "npm run lint:cli && lerna publish --force-publish=* --npm-tag=next"
}, },
"dependencies": { "dependencies": {
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
"rollup-plugin-commonjs": "^10.0.1", "rollup-plugin-commonjs": "^10.0.1",
"rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.1.0", "rollup-plugin-replace": "^2.1.0",
"shell-exec": "^1.0.2",
"strip-json-comments": "^2.0.1", "strip-json-comments": "^2.0.1",
"vue": "^2.6.8", "vue": "^2.6.8",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
......
...@@ -2647,8 +2647,12 @@ var serviceContext = (function () { ...@@ -2647,8 +2647,12 @@ var serviceContext = (function () {
header: { header: {
type: Object, type: Object,
validator (value, params) { validator (value, params) {
params.header = value || {}; const header = params.header = value || {};
params.header['content-type'] = params.header['content-type'] || 'application/json'; if (params.method !== method.GET) {
if (!Object.keys(header).find(key => key.toLowerCase() === 'content-type')) {
header['Content-Type'] = 'application/json';
}
}
} }
}, },
dataType: { dataType: {
......
{ {
"name": "@dcloudio/uni-app-plus-nvue", "name": "@dcloudio/uni-app-plus-nvue",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app app-plus-nvue", "description": "uni-app app-plus-nvue",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/uni-app-plus", "name": "@dcloudio/uni-app-plus",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app app-plus", "description": "uni-app app-plus",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/uni-cli-shared", "name": "@dcloudio/uni-cli-shared",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-cli-shared", "description": "uni-cli-shared",
"main": "lib/index.js", "main": "lib/index.js",
"repository": { "repository": {
...@@ -20,5 +20,5 @@ ...@@ -20,5 +20,5 @@
"hash-sum": "^1.0.2", "hash-sum": "^1.0.2",
"strip-json-comments": "^2.0.1" "strip-json-comments": "^2.0.1"
}, },
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/uni-h5-ui", "name": "@dcloudio/uni-h5-ui",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app h5 ui", "description": "uni-app h5 ui",
"main": "dist/index.umd.min.js", "main": "dist/index.umd.min.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/uni-h5", "name": "@dcloudio/uni-h5",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app h5", "description": "uni-app h5",
"main": "dist/index.umd.min.js", "main": "dist/index.umd.min.js",
"repository": { "repository": {
...@@ -18,5 +18,5 @@ ...@@ -18,5 +18,5 @@
"intersection-observer": "^0.7.0", "intersection-observer": "^0.7.0",
"safe-area-insets": "^1.4.1" "safe-area-insets": "^1.4.1"
}, },
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/uni-mp-alipay", "name": "@dcloudio/uni-mp-alipay",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app mp-alipay", "description": "uni-app mp-alipay",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/uni-mp-baidu", "name": "@dcloudio/uni-mp-baidu",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app mp-baidu", "description": "uni-app mp-baidu",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/uni-mp-qq", "name": "@dcloudio/uni-mp-qq",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app mp-qq", "description": "uni-app mp-qq",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
...@@ -1376,21 +1376,45 @@ function isPage () { ...@@ -1376,21 +1376,45 @@ function isPage () {
function initRefs (vm) { function initRefs (vm) {
const mpInstance = vm.$scope; const mpInstance = vm.$scope;
mpInstance.selectAllComponents('.vue-ref', (components) => { /* eslint-disable no-undef */
components.forEach(component => { const minorVersion = parseInt(tt.getSystemInfoSync().SDKVersion.split('.')[1]);
const ref = component.dataset.ref; if (minorVersion > 16) {
vm.$refs[ref] = component.$vm || component; Object.defineProperty(vm, '$refs', {
}); get () {
}); const $refs = {};
mpInstance.selectAllComponents('.vue-ref-in-for', (forComponents) => { const components = mpInstance.selectAllComponents('.vue-ref');
forComponents.forEach(component => { components.forEach(component => {
const ref = component.dataset.ref; const ref = component.dataset.ref;
if (!vm.$refs[ref]) { $refs[ref] = component.$vm || component;
vm.$refs[ref] = []; });
const forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
forComponents.forEach(component => {
const ref = component.dataset.ref;
if (!$refs[ref]) {
$refs[ref] = [];
}
$refs[ref].push(component.$vm || component);
});
return $refs
} }
vm.$refs[ref].push(component.$vm || component);
}); });
}); } else {
mpInstance.selectAllComponents('.vue-ref', (components) => {
components.forEach(component => {
const ref = component.dataset.ref;
vm.$refs[ref] = component.$vm || component;
});
});
mpInstance.selectAllComponents('.vue-ref-in-for', (forComponents) => {
forComponents.forEach(component => {
const ref = component.dataset.ref;
if (!vm.$refs[ref]) {
vm.$refs[ref] = [];
}
vm.$refs[ref].push(component.$vm || component);
});
});
}
} }
const instances = Object.create(null); const instances = Object.create(null);
......
{ {
"name": "@dcloudio/uni-mp-toutiao", "name": "@dcloudio/uni-mp-toutiao",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app mp-toutiao", "description": "uni-app mp-toutiao",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/uni-mp-weixin", "name": "@dcloudio/uni-mp-weixin",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app mp-weixin", "description": "uni-app mp-weixin",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
...@@ -652,12 +652,9 @@ class Util { ...@@ -652,12 +652,9 @@ class Util {
// } // }
}, },
fail: (e) => { fail: (e) => {
// if (process.env.NODE_ENV === 'development') {
// console.log('stat request fail', e);
// }
if (++this._retry < 3) { if (++this._retry < 3) {
setTimeout(() => { setTimeout(() => {
this.request(data); this._sendRequest(optionsData);
}, 1000); }, 1000);
} }
} }
...@@ -836,7 +833,15 @@ const lifecycle = { ...@@ -836,7 +833,15 @@ const lifecycle = {
stat.ready(this); stat.ready(this);
}, },
onLoad(options) { onLoad(options) {
stat.load(options, this); stat.load(options, this);
// 重写分享,获取分享上报事件
if (this.$scope && this.$scope.onShareAppMessage) {
let oldShareAppMessage = this.$scope.onShareAppMessage;
this.$scope.onShareAppMessage = function(options) {
stat.interceptShare(false);
return oldShareAppMessage.call(this, options)
};
}
}, },
onShow() { onShow() {
isHide = false; isHide = false;
...@@ -855,17 +860,14 @@ const lifecycle = { ...@@ -855,17 +860,14 @@ const lifecycle = {
}, },
onError(e) { onError(e) {
stat.error(e); stat.error(e);
},
onShareAppMessage() {
stat.interceptShare(false);
} }
}; };
function main() { function main() {
const Vue = require('vue');
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
uni.report = function(type, options) {}; uni.report = function(type, options) {};
}else{ }else{
const Vue = require('vue');
(Vue.default || Vue).mixin(lifecycle); (Vue.default || Vue).mixin(lifecycle);
uni.report = function(type, options) { uni.report = function(type, options) {
stat.sendEvent(type, options); stat.sendEvent(type, options);
......
{ {
"name": "@dcloudio/uni-stat", "name": "@dcloudio/uni-stat",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -34,5 +34,5 @@ ...@@ -34,5 +34,5 @@
"rollup-plugin-replace": "^2.2.0", "rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.2" "rollup-plugin-uglify": "^6.0.2"
}, },
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
...@@ -9,7 +9,15 @@ const lifecycle = { ...@@ -9,7 +9,15 @@ const lifecycle = {
stat.ready(this); stat.ready(this);
}, },
onLoad(options) { onLoad(options) {
stat.load(options, this); stat.load(options, this);
// 重写分享,获取分享上报事件
if (this.$scope && this.$scope.onShareAppMessage) {
let oldShareAppMessage = this.$scope.onShareAppMessage;
this.$scope.onShareAppMessage = function(options) {
stat.interceptShare(false);
return oldShareAppMessage.call(this, options)
}
}
}, },
onShow() { onShow() {
isHide = false isHide = false
...@@ -28,17 +36,14 @@ const lifecycle = { ...@@ -28,17 +36,14 @@ const lifecycle = {
}, },
onError(e) { onError(e) {
stat.error(e) stat.error(e)
},
onShareAppMessage() {
stat.interceptShare(false)
} }
} }
function main() { function main() {
const Vue = require('vue');
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
uni.report = function(type, options) {}; uni.report = function(type, options) {};
}else{ }else{
const Vue = require('vue');
(Vue.default || Vue).mixin(lifecycle); (Vue.default || Vue).mixin(lifecycle);
uni.report = function(type, options) { uni.report = function(type, options) {
stat.sendEvent(type, options); stat.sendEvent(type, options);
......
...@@ -387,12 +387,9 @@ class Util { ...@@ -387,12 +387,9 @@ class Util {
// } // }
}, },
fail: (e) => { fail: (e) => {
// if (process.env.NODE_ENV === 'development') {
// console.log('stat request fail', e);
// }
if (++this._retry < 3) { if (++this._retry < 3) {
setTimeout(() => { setTimeout(() => {
this.request(data); this._sendRequest(optionsData);
}, 1000); }, 1000);
} }
} }
......
{ {
"name": "@dcloudio/uni-template-compiler", "name": "@dcloudio/uni-template-compiler",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-template-compiler", "description": "uni-template-compiler",
"main": "lib/index.js", "main": "lib/index.js",
"repository": { "repository": {
...@@ -22,5 +22,5 @@ ...@@ -22,5 +22,5 @@
"@babel/types": "^7.3.3", "@babel/types": "^7.3.3",
"vue-template-compiler": "^2.6.10" "vue-template-compiler": "^2.6.10"
}, },
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/vue-cli-plugin-hbuilderx", "name": "@dcloudio/vue-cli-plugin-hbuilderx",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "HBuilderX plugin for vue-cli 3", "description": "HBuilderX plugin for vue-cli 3",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
...@@ -18,5 +18,5 @@ ...@@ -18,5 +18,5 @@
"css": "~2.2.1", "css": "~2.2.1",
"escodegen": "^1.8.1" "escodegen": "^1.8.1"
}, },
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/vue-cli-plugin-uni-optimize", "name": "@dcloudio/vue-cli-plugin-uni-optimize",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app optimize plugin for vue-cli 3", "description": "uni-app optimize plugin for vue-cli 3",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
console.log('uni-app v' + require('../package.json').version) console.log('uni-app v' + require('@dcloudio/webpack-uni-pages-loader/package.json')['uni-app']['compilerVersion'])
console.log('uni-app cli v' + require('../package.json').version)
console.log(require('chalk').bold('\nEnvironment Info:')) console.log(require('chalk').bold('\nEnvironment Info:'))
require('envinfo').run({ require('envinfo').run({
System: ['OS', 'CPU'], System: ['OS', 'CPU'],
......
...@@ -23,12 +23,12 @@ module.exports = async function checkUpdate () { ...@@ -23,12 +23,12 @@ module.exports = async function checkUpdate () {
if (update) { if (update) {
if (pkg.version.split('.')[0] !== update.latest.split('.')[0]) { if (pkg.version.split('.')[0] !== update.latest.split('.')[0]) {
console.log(`发现 uni-app 新版本 ${update.latest}`) console.log(`发现 uni-app cli 新版本 ${update.latest}`)
console.log(`1.修改 package.json 中 @dcloudio 相关包版本为 ^${update.latest}`) console.log(`1.修改 package.json 中 @dcloudio 相关包版本为 ^${update.latest}`)
console.log('2.删除 package-lock.json 或 yarn.lock') console.log('2.删除 package-lock.json 或 yarn.lock')
console.log('3.执行 npm install 或 yarn') console.log('3.执行 npm install 或 yarn')
} else { } else {
console.log(`发现 uni-app 新版本 ${update.latest}. 请执行 npm update 升级`) console.log(`发现 uni-app cli 新版本 ${update.latest}. 请执行 npm update 升级`)
} }
} }
} }
...@@ -67,7 +67,9 @@ process.UNI_STAT_CONFIG = { ...@@ -67,7 +67,9 @@ process.UNI_STAT_CONFIG = {
// 默认启用 自定义组件模式 // 默认启用 自定义组件模式
// if (isInHBuilderXAlpha) { // if (isInHBuilderXAlpha) {
let usingComponentsAbsent = false
if (!platformOptions.hasOwnProperty('usingComponents')) { if (!platformOptions.hasOwnProperty('usingComponents')) {
usingComponentsAbsent = true
platformOptions.usingComponents = true platformOptions.usingComponents = true
} }
// } // }
...@@ -170,7 +172,12 @@ if (process.env.UNI_USING_COMPONENTS) { // 是否启用分包优化 ...@@ -170,7 +172,12 @@ if (process.env.UNI_USING_COMPONENTS) { // 是否启用分包优化
} }
} }
const warningMsg = `uni-app将于2019年11月1日起停止支持非自定义组件模式 [详情](https://ask.dcloud.net.cn/article/36385)` const warningMsg =
usingComponentsAbsent
? `该应用之前可能是非自定义组件模式,目前以自定义组件模式运行。非自定义组件将于2019年11月1日起停止支持。详见:https://ask.dcloud.net.cn/article/36385`
: `uni-app将于2019年11月1日起停止支持非自定义组件模式 [详情](https://ask.dcloud.net.cn/article/36385)`
const needWarning = !platformOptions.usingComponents || usingComponentsAbsent
// 输出编译器版本等信息 // 输出编译器版本等信息
if (process.env.UNI_PLATFORM !== 'h5') { if (process.env.UNI_PLATFORM !== 'h5') {
try { try {
...@@ -190,20 +197,20 @@ if (process.env.UNI_PLATFORM !== 'h5') { ...@@ -190,20 +197,20 @@ if (process.env.UNI_PLATFORM !== 'h5') {
}).length) { }).length) {
console.log(info) console.log(info)
console.log(modeText) console.log(modeText)
if (!platformOptions.usingComponents) { if (needWarning) {
console.log(warningMsg) console.log(warningMsg)
} }
console.log('当前nvue编译模式:' + (isNVueCompiler ? 'uni-app' : 'weex') + console.log('当前nvue编译模式:' + (isNVueCompiler ? 'uni-app' : 'weex') +
' 。编译模式差异见:https://ask.dcloud.net.cn/article/36074') ' 。编译模式差异见:https://ask.dcloud.net.cn/article/36074')
} else { } else {
console.log(info + '' + modeText) console.log(info + '' + modeText)
if (!platformOptions.usingComponents) { if (needWarning) {
console.log(warningMsg) console.log(warningMsg)
} }
} }
} else { } else {
console.log(modeText) console.log(modeText)
if (!platformOptions.usingComponents) { if (needWarning) {
console.log(warningMsg) console.log(warningMsg)
} }
} }
......
{ {
"name": "@dcloudio/vue-cli-plugin-uni", "name": "@dcloudio/vue-cli-plugin-uni",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app plugin for vue-cli 3", "description": "uni-app plugin for vue-cli 3",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@dcloudio/uni-stat": "^2.0.0-23020190919001", "@dcloudio/uni-stat": "^2.0.0-23220190921001",
"copy-webpack-plugin": "^4.6.0", "copy-webpack-plugin": "^4.6.0",
"cross-env": "^5.2.0", "cross-env": "^5.2.0",
"envinfo": "^6.0.1", "envinfo": "^6.0.1",
...@@ -34,5 +34,5 @@ ...@@ -34,5 +34,5 @@
"wrap-loader": "^0.2.0", "wrap-loader": "^0.2.0",
"xregexp": "4.0.0" "xregexp": "4.0.0"
}, },
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/webpack-uni-mp-loader", "name": "@dcloudio/webpack-uni-mp-loader",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "webpack-uni-mp-loader", "description": "webpack-uni-mp-loader",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
...@@ -16,5 +16,5 @@ ...@@ -16,5 +16,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
{ {
"name": "@dcloudio/webpack-uni-pages-loader", "name": "@dcloudio/webpack-uni-pages-loader",
"version": "2.0.0-23020190919001", "version": "2.0.0-23220190921001",
"description": "uni-app pages.json loader", "description": "uni-app pages.json loader",
"main": "lib/index.js", "main": "lib/index.js",
"repository": { "repository": {
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"strip-json-comments": "^2.0.1" "strip-json-comments": "^2.0.1"
}, },
"uni-app": { "uni-app": {
"compilerVersion": "2.3.0" "compilerVersion": "2.3.2"
}, },
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264" "gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
} }
...@@ -77,8 +77,12 @@ export const request = { ...@@ -77,8 +77,12 @@ export const request = {
header: { header: {
type: Object, type: Object,
validator (value, params) { validator (value, params) {
params.header = value || {} const header = params.header = value || {}
params.header['content-type'] = params.header['content-type'] || 'application/json' if (params.method !== method.GET) {
if (!Object.keys(header).find(key => key.toLowerCase() === 'content-type')) {
header['Content-Type'] = 'application/json'
}
}
} }
}, },
dataType: { dataType: {
...@@ -94,4 +98,4 @@ export const request = { ...@@ -94,4 +98,4 @@ export const request = {
params.responseType = Object.values(responseType).indexOf(value) < 0 ? responseType.TEXT : value params.responseType = Object.values(responseType).indexOf(value) < 0 ? responseType.TEXT : value
} }
} }
} }
import { import {
invoke, invoke,
publish, publish,
pack, arrayBufferToBase64,
unpack base64ToArrayBuffer
} from '../../bridge' } from '../../bridge'
/** /**
* 执行蓝牙相关方法 * 执行蓝牙相关方法
*/ */
function bluetoothExec (method, callbackId, data = {}) { function bluetoothExec (method, callbackId, data = {}, beforeSuccess) {
var deviceId = data.deviceId var deviceId = data.deviceId
if (deviceId) { if (deviceId) {
data.deviceId = deviceId.toUpperCase() data.deviceId = deviceId.toUpperCase()
...@@ -20,7 +20,10 @@ function bluetoothExec (method, callbackId, data = {}) { ...@@ -20,7 +20,10 @@ function bluetoothExec (method, callbackId, data = {}) {
plus.bluetooth[method.replace('Changed', 'Change')](Object.assign(data, { plus.bluetooth[method.replace('Changed', 'Change')](Object.assign(data, {
success (data) { success (data) {
invoke(callbackId, Object.assign({}, pack(data), { if (typeof beforeSuccess === 'function') {
beforeSuccess(data)
}
invoke(callbackId, Object.assign({}, data, {
errMsg: `${method}:ok`, errMsg: `${method}:ok`,
code: undefined, code: undefined,
message: undefined message: undefined
...@@ -37,9 +40,12 @@ function bluetoothExec (method, callbackId, data = {}) { ...@@ -37,9 +40,12 @@ function bluetoothExec (method, callbackId, data = {}) {
/** /**
* 监听蓝牙相关事件 * 监听蓝牙相关事件
*/ */
function bluetoothOn (method) { function bluetoothOn (method, beforeSuccess) {
plus.bluetooth[method.replace('Changed', 'Change')](function (data) { plus.bluetooth[method.replace('Changed', 'Change')](function (data) {
publish(method, Object.assign({}, pack(data), { if (typeof beforeSuccess === 'function') {
beforeSuccess(data)
}
publish(method, Object.assign({}, data, {
code: undefined, code: undefined,
message: undefined message: undefined
})) }))
...@@ -47,6 +53,16 @@ function bluetoothOn (method) { ...@@ -47,6 +53,16 @@ function bluetoothOn (method) {
return true return true
} }
function checkDevices (data) {
data.devices = data.devices.map(device => {
var advertisData = device.advertisData
if (advertisData && typeof advertisData !== 'string') {
device.advertisData = arrayBufferToBase64(advertisData)
}
return device
})
}
var onBluetoothAdapterStateChange var onBluetoothAdapterStateChange
var onBluetoothDeviceFound var onBluetoothDeviceFound
var onBLEConnectionStateChange var onBLEConnectionStateChange
...@@ -67,7 +83,7 @@ export function getBluetoothAdapterState (data, callbackId) { ...@@ -67,7 +83,7 @@ export function getBluetoothAdapterState (data, callbackId) {
} }
export function startBluetoothDevicesDiscovery (data, callbackId) { export function startBluetoothDevicesDiscovery (data, callbackId) {
onBluetoothDeviceFound = onBluetoothDeviceFound || bluetoothOn('onBluetoothDeviceFound') onBluetoothDeviceFound = onBluetoothDeviceFound || bluetoothOn('onBluetoothDeviceFound', checkDevices)
bluetoothExec('startBluetoothDevicesDiscovery', callbackId, data) bluetoothExec('startBluetoothDevicesDiscovery', callbackId, data)
} }
...@@ -76,7 +92,7 @@ export function stopBluetoothDevicesDiscovery (data, callbackId) { ...@@ -76,7 +92,7 @@ export function stopBluetoothDevicesDiscovery (data, callbackId) {
} }
export function getBluetoothDevices (data, callbackId) { export function getBluetoothDevices (data, callbackId) {
bluetoothExec('getBluetoothDevices', callbackId, {}) bluetoothExec('getBluetoothDevices', callbackId, {}, checkDevices)
} }
export function getConnectedBluetoothDevices (data, callbackId) { export function getConnectedBluetoothDevices (data, callbackId) {
...@@ -102,12 +118,18 @@ export function getBLEDeviceCharacteristics (data, callbackId) { ...@@ -102,12 +118,18 @@ export function getBLEDeviceCharacteristics (data, callbackId) {
} }
export function notifyBLECharacteristicValueChange (data, callbackId) { export function notifyBLECharacteristicValueChange (data, callbackId) {
onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange') onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange',
data => {
data.value = arrayBufferToBase64(data.value)
})
bluetoothExec('notifyBLECharacteristicValueChange', callbackId, data) bluetoothExec('notifyBLECharacteristicValueChange', callbackId, data)
} }
export function notifyBLECharacteristicValueChanged (data, callbackId) { export function notifyBLECharacteristicValueChanged (data, callbackId) {
onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange') onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange',
data => {
data.value = arrayBufferToBase64(data.value)
})
bluetoothExec('notifyBLECharacteristicValueChanged', callbackId, data) bluetoothExec('notifyBLECharacteristicValueChanged', callbackId, data)
} }
...@@ -116,5 +138,6 @@ export function readBLECharacteristicValue (data, callbackId) { ...@@ -116,5 +138,6 @@ export function readBLECharacteristicValue (data, callbackId) {
} }
export function writeBLECharacteristicValue (data, callbackId) { export function writeBLECharacteristicValue (data, callbackId) {
bluetoothExec('writeBLECharacteristicValue', callbackId, unpack(data)) data.value = base64ToArrayBuffer(data.value)
bluetoothExec('writeBLECharacteristicValue', callbackId, data)
} }
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
v-if="!searchInput" v-if="!searchInput"
class="uni-page-head-bd"> class="uni-page-head-bd">
<div <div
:style="{fontSize:titleSize}" :style="{fontSize:titleSize,opacity:type==='transparent'?0:1}"
class="uni-page-head__title" class="uni-page-head__title"
> >
<i <i
......
...@@ -6,7 +6,7 @@ export default { ...@@ -6,7 +6,7 @@ export default {
mounted () { mounted () {
if (this.type === 'transparent') { if (this.type === 'transparent') {
const transparentElemStyle = this.$el.querySelector('.uni-page-head-transparent').style const transparentElemStyle = this.$el.querySelector('.uni-page-head-transparent').style
// const titleElem = this.$el.querySelector('.uni-page-head__title') const titleElem = this.$el.querySelector('.uni-page-head__title')
const iconElems = this.$el.querySelectorAll('.uni-btn-icon') const iconElems = this.$el.querySelectorAll('.uni-btn-icon')
const iconElemsStyles = [] const iconElemsStyles = []
const textColor = this.textColor const textColor = this.textColor
...@@ -40,10 +40,9 @@ export default { ...@@ -40,10 +40,9 @@ export default {
} }
this._A = alpha this._A = alpha
// TODO 暂时仅处理背景色 // TODO 暂时仅处理背景色
// 对齐支付宝小程序,标题不透明渐变 if (titleElem) {
// if (titleElem) { titleElem.style.opacity = alpha
// titleElem.style.opacity = alpha }
// }
transparentElemStyle.backgroundColor = `rgba(${this._R},${this._G},${this._B},${alpha})` transparentElemStyle.backgroundColor = `rgba(${this._R},${this._G},${this._B},${alpha})`
borderRadiusElemsStyles.forEach(function (borderRadiusElemStyle, index) { borderRadiusElemsStyles.forEach(function (borderRadiusElemStyle, index) {
let oldColor = oldColors[index] let oldColor = oldColors[index]
......
...@@ -70,13 +70,6 @@ export function request ({ ...@@ -70,13 +70,6 @@ export function request ({
} }
} }
if (method !== 'GET') { if (method !== 'GET') {
if (!contentType) {
/**
* 跨域时部分服务器OPTION响应头Access-Control-Allow-Headers未包含Content-Type会请求失败
*/
header['Content-Type'] = 'application/json'
contentType = 'json'
}
if (typeof data === 'string' || data instanceof ArrayBuffer) { if (typeof data === 'string' || data instanceof ArrayBuffer) {
body = data body = data
} else { } else {
......
...@@ -10,21 +10,45 @@ export function isPage () { ...@@ -10,21 +10,45 @@ export function isPage () {
export function initRefs (vm) { export function initRefs (vm) {
const mpInstance = vm.$scope const mpInstance = vm.$scope
mpInstance.selectAllComponents('.vue-ref', (components) => { /* eslint-disable no-undef */
components.forEach(component => { const minorVersion = parseInt(tt.getSystemInfoSync().SDKVersion.split('.')[1])
const ref = component.dataset.ref if (minorVersion > 16) {
vm.$refs[ref] = component.$vm || component Object.defineProperty(vm, '$refs', {
}) get () {
}) const $refs = {}
mpInstance.selectAllComponents('.vue-ref-in-for', (forComponents) => { const components = mpInstance.selectAllComponents('.vue-ref')
forComponents.forEach(component => { components.forEach(component => {
const ref = component.dataset.ref const ref = component.dataset.ref
if (!vm.$refs[ref]) { $refs[ref] = component.$vm || component
vm.$refs[ref] = [] })
const forComponents = mpInstance.selectAllComponents('.vue-ref-in-for')
forComponents.forEach(component => {
const ref = component.dataset.ref
if (!$refs[ref]) {
$refs[ref] = []
}
$refs[ref].push(component.$vm || component)
})
return $refs
} }
vm.$refs[ref].push(component.$vm || component)
}) })
}) } else {
mpInstance.selectAllComponents('.vue-ref', (components) => {
components.forEach(component => {
const ref = component.dataset.ref
vm.$refs[ref] = component.$vm || component
})
})
mpInstance.selectAllComponents('.vue-ref-in-for', (forComponents) => {
forComponents.forEach(component => {
const ref = component.dataset.ref
if (!vm.$refs[ref]) {
vm.$refs[ref] = []
}
vm.$refs[ref].push(component.$vm || component)
})
})
}
} }
const instances = Object.create(null) const instances = Object.create(null)
...@@ -77,4 +101,4 @@ export function handleLink ({ ...@@ -77,4 +101,4 @@ export function handleLink ({
vm._isMounted = true vm._isMounted = true
vm.__call_hook('mounted') vm.__call_hook('mounted')
vm.__call_hook('onReady') vm.__call_hook('onReady')
} }
...@@ -7934,6 +7934,10 @@ shebang-regex@^1.0.0: ...@@ -7934,6 +7934,10 @@ shebang-regex@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.npm.taobao.org/shebang-regex/download/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" resolved "https://registry.npm.taobao.org/shebang-regex/download/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
shell-exec@^1.0.2:
version "1.0.2"
resolved "https://registry.npm.taobao.org/shell-exec/download/shell-exec-1.0.2.tgz#2e9361b0fde1d73f476c4b6671fa17785f696756"
shell-quote@^1.6.1: shell-quote@^1.6.1:
version "1.6.1" version "1.6.1"
resolved "https://registry.npm.taobao.org/shell-quote/download/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767" resolved "https://registry.npm.taobao.org/shell-quote/download/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册