提交 a8583861 编写于 作者: Q qiang

Merge commit 'd26b2061'

......@@ -12,5 +12,5 @@
"message": "chore(release): publish %s"
}
},
"version": "2.0.0-23020190919001"
"version": "2.0.0-23220190921001"
}
{
"name": "uniapp-js-framework",
"version": "0.0.1",
"scripts": {
"scripts": {
"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: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",
"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: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",
......@@ -22,7 +22,7 @@
"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",
"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"
},
"dependencies": {
......@@ -63,6 +63,7 @@
"rollup-plugin-commonjs": "^10.0.1",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.1.0",
"shell-exec": "^1.0.2",
"strip-json-comments": "^2.0.1",
"vue": "^2.6.8",
"vue-router": "^3.0.1",
......
......@@ -2647,8 +2647,12 @@ var serviceContext = (function () {
header: {
type: Object,
validator (value, params) {
params.header = value || {};
params.header['content-type'] = params.header['content-type'] || 'application/json';
const header = params.header = value || {};
if (params.method !== method.GET) {
if (!Object.keys(header).find(key => key.toLowerCase() === 'content-type')) {
header['Content-Type'] = 'application/json';
}
}
}
},
dataType: {
......
{
"name": "@dcloudio/uni-app-plus-nvue",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-app app-plus-nvue",
"main": "dist/index.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"name": "@dcloudio/uni-app-plus",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-app app-plus",
"main": "dist/index.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"name": "@dcloudio/uni-cli-shared",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-cli-shared",
"main": "lib/index.js",
"repository": {
......@@ -20,5 +20,5 @@
"hash-sum": "^1.0.2",
"strip-json-comments": "^2.0.1"
},
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"name": "@dcloudio/uni-h5-ui",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-app h5 ui",
"main": "dist/index.umd.min.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"name": "@dcloudio/uni-h5",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-app h5",
"main": "dist/index.umd.min.js",
"repository": {
......@@ -18,5 +18,5 @@
"intersection-observer": "^0.7.0",
"safe-area-insets": "^1.4.1"
},
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"name": "@dcloudio/uni-mp-alipay",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-app mp-alipay",
"main": "dist/index.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"name": "@dcloudio/uni-mp-baidu",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"name": "@dcloudio/uni-mp-qq",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-app mp-qq",
"main": "dist/index.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
......@@ -1376,21 +1376,45 @@ function isPage () {
function initRefs (vm) {
const mpInstance = vm.$scope;
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] = [];
/* eslint-disable no-undef */
const minorVersion = parseInt(tt.getSystemInfoSync().SDKVersion.split('.')[1]);
if (minorVersion > 16) {
Object.defineProperty(vm, '$refs', {
get () {
const $refs = {};
const components = mpInstance.selectAllComponents('.vue-ref');
components.forEach(component => {
const ref = component.dataset.ref;
$refs[ref] = component.$vm || component;
});
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);
......
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"name": "@dcloudio/uni-mp-weixin",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
......@@ -652,12 +652,9 @@ class Util {
// }
},
fail: (e) => {
// if (process.env.NODE_ENV === 'development') {
// console.log('stat request fail', e);
// }
if (++this._retry < 3) {
setTimeout(() => {
this.request(data);
this._sendRequest(optionsData);
}, 1000);
}
}
......@@ -836,7 +833,15 @@ const lifecycle = {
stat.ready(this);
},
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() {
isHide = false;
......@@ -855,17 +860,14 @@ const lifecycle = {
},
onError(e) {
stat.error(e);
},
onShareAppMessage() {
stat.interceptShare(false);
}
};
function main() {
const Vue = require('vue');
if (process.env.NODE_ENV === 'development') {
uni.report = function(type, options) {};
}else{
const Vue = require('vue');
(Vue.default || Vue).mixin(lifecycle);
uni.report = function(type, options) {
stat.sendEvent(type, options);
......
{
"name": "@dcloudio/uni-stat",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "",
"main": "dist/index.js",
"repository": {
......@@ -34,5 +34,5 @@
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.2"
},
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
......@@ -9,7 +9,15 @@ const lifecycle = {
stat.ready(this);
},
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() {
isHide = false
......@@ -28,17 +36,14 @@ const lifecycle = {
},
onError(e) {
stat.error(e)
},
onShareAppMessage() {
stat.interceptShare(false)
}
}
function main() {
const Vue = require('vue');
if (process.env.NODE_ENV === 'development') {
uni.report = function(type, options) {};
}else{
const Vue = require('vue');
(Vue.default || Vue).mixin(lifecycle);
uni.report = function(type, options) {
stat.sendEvent(type, options);
......
......@@ -387,12 +387,9 @@ class Util {
// }
},
fail: (e) => {
// if (process.env.NODE_ENV === 'development') {
// console.log('stat request fail', e);
// }
if (++this._retry < 3) {
setTimeout(() => {
this.request(data);
this._sendRequest(optionsData);
}, 1000);
}
}
......
{
"name": "@dcloudio/uni-template-compiler",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-template-compiler",
"main": "lib/index.js",
"repository": {
......@@ -22,5 +22,5 @@
"@babel/types": "^7.3.3",
"vue-template-compiler": "^2.6.10"
},
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"name": "@dcloudio/vue-cli-plugin-hbuilderx",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "HBuilderX plugin for vue-cli 3",
"main": "index.js",
"repository": {
......@@ -18,5 +18,5 @@
"css": "~2.2.1",
"escodegen": "^1.8.1"
},
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"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",
"main": "index.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"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:'))
require('envinfo').run({
System: ['OS', 'CPU'],
......
......@@ -23,12 +23,12 @@ module.exports = async function checkUpdate () {
if (update) {
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('2.删除 package-lock.json 或 yarn.lock')
console.log('3.执行 npm install 或 yarn')
} 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 = {
// 默认启用 自定义组件模式
// if (isInHBuilderXAlpha) {
let usingComponentsAbsent = false
if (!platformOptions.hasOwnProperty('usingComponents')) {
usingComponentsAbsent = true
platformOptions.usingComponents = true
}
// }
......@@ -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') {
try {
......@@ -190,20 +197,20 @@ if (process.env.UNI_PLATFORM !== 'h5') {
}).length) {
console.log(info)
console.log(modeText)
if (!platformOptions.usingComponents) {
if (needWarning) {
console.log(warningMsg)
}
console.log('当前nvue编译模式:' + (isNVueCompiler ? 'uni-app' : 'weex') +
' 。编译模式差异见:https://ask.dcloud.net.cn/article/36074')
} else {
console.log(info + '' + modeText)
if (!platformOptions.usingComponents) {
if (needWarning) {
console.log(warningMsg)
}
}
} else {
console.log(modeText)
if (!platformOptions.usingComponents) {
if (needWarning) {
console.log(warningMsg)
}
}
......
{
"name": "@dcloudio/vue-cli-plugin-uni",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-app plugin for vue-cli 3",
"main": "index.js",
"repository": {
......@@ -17,7 +17,7 @@
"author": "fxy060608",
"license": "Apache-2.0",
"dependencies": {
"@dcloudio/uni-stat": "^2.0.0-23020190919001",
"@dcloudio/uni-stat": "^2.0.0-23220190921001",
"copy-webpack-plugin": "^4.6.0",
"cross-env": "^5.2.0",
"envinfo": "^6.0.1",
......@@ -34,5 +34,5 @@
"wrap-loader": "^0.2.0",
"xregexp": "4.0.0"
},
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"name": "@dcloudio/webpack-uni-mp-loader",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "webpack-uni-mp-loader",
"main": "index.js",
"repository": {
......@@ -16,5 +16,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
{
"name": "@dcloudio/webpack-uni-pages-loader",
"version": "2.0.0-23020190919001",
"version": "2.0.0-23220190921001",
"description": "uni-app pages.json loader",
"main": "lib/index.js",
"repository": {
......@@ -21,7 +21,7 @@
"strip-json-comments": "^2.0.1"
},
"uni-app": {
"compilerVersion": "2.3.0"
"compilerVersion": "2.3.2"
},
"gitHead": "0fac47b62d100213ce48c29dd9d0a335f8a00264"
"gitHead": "a9dfc1e2b7a5608e010228c06a040b8f267aace2"
}
......@@ -77,8 +77,12 @@ export const request = {
header: {
type: Object,
validator (value, params) {
params.header = value || {}
params.header['content-type'] = params.header['content-type'] || 'application/json'
const header = params.header = value || {}
if (params.method !== method.GET) {
if (!Object.keys(header).find(key => key.toLowerCase() === 'content-type')) {
header['Content-Type'] = 'application/json'
}
}
}
},
dataType: {
......@@ -94,4 +98,4 @@ export const request = {
params.responseType = Object.values(responseType).indexOf(value) < 0 ? responseType.TEXT : value
}
}
}
}
import {
invoke,
publish,
pack,
unpack
publish,
arrayBufferToBase64,
base64ToArrayBuffer
} from '../../bridge'
/**
* 执行蓝牙相关方法
*/
function bluetoothExec (method, callbackId, data = {}) {
function bluetoothExec (method, callbackId, data = {}, beforeSuccess) {
var deviceId = data.deviceId
if (deviceId) {
data.deviceId = deviceId.toUpperCase()
......@@ -20,7 +20,10 @@ function bluetoothExec (method, callbackId, data = {}) {
plus.bluetooth[method.replace('Changed', 'Change')](Object.assign(data, {
success (data) {
invoke(callbackId, Object.assign({}, pack(data), {
if (typeof beforeSuccess === 'function') {
beforeSuccess(data)
}
invoke(callbackId, Object.assign({}, data, {
errMsg: `${method}:ok`,
code: undefined,
message: undefined
......@@ -37,9 +40,12 @@ function bluetoothExec (method, callbackId, data = {}) {
/**
* 监听蓝牙相关事件
*/
function bluetoothOn (method) {
function bluetoothOn (method, beforeSuccess) {
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,
message: undefined
}))
......@@ -47,6 +53,16 @@ function bluetoothOn (method) {
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 onBluetoothDeviceFound
var onBLEConnectionStateChange
......@@ -67,7 +83,7 @@ export function getBluetoothAdapterState (data, callbackId) {
}
export function startBluetoothDevicesDiscovery (data, callbackId) {
onBluetoothDeviceFound = onBluetoothDeviceFound || bluetoothOn('onBluetoothDeviceFound')
onBluetoothDeviceFound = onBluetoothDeviceFound || bluetoothOn('onBluetoothDeviceFound', checkDevices)
bluetoothExec('startBluetoothDevicesDiscovery', callbackId, data)
}
......@@ -76,7 +92,7 @@ export function stopBluetoothDevicesDiscovery (data, callbackId) {
}
export function getBluetoothDevices (data, callbackId) {
bluetoothExec('getBluetoothDevices', callbackId, {})
bluetoothExec('getBluetoothDevices', callbackId, {}, checkDevices)
}
export function getConnectedBluetoothDevices (data, callbackId) {
......@@ -102,12 +118,18 @@ export function getBLEDeviceCharacteristics (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)
}
export function notifyBLECharacteristicValueChanged (data, callbackId) {
onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange')
onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange',
data => {
data.value = arrayBufferToBase64(data.value)
})
bluetoothExec('notifyBLECharacteristicValueChanged', callbackId, data)
}
......@@ -116,5 +138,6 @@ export function readBLECharacteristicValue (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 @@
v-if="!searchInput"
class="uni-page-head-bd">
<div
:style="{fontSize:titleSize}"
:style="{fontSize:titleSize,opacity:type==='transparent'?0:1}"
class="uni-page-head__title"
>
<i
......
......@@ -6,7 +6,7 @@ export default {
mounted () {
if (this.type === 'transparent') {
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 iconElemsStyles = []
const textColor = this.textColor
......@@ -40,10 +40,9 @@ export default {
}
this._A = alpha
// TODO 暂时仅处理背景色
// 对齐支付宝小程序,标题不透明渐变
// if (titleElem) {
// titleElem.style.opacity = alpha
// }
if (titleElem) {
titleElem.style.opacity = alpha
}
transparentElemStyle.backgroundColor = `rgba(${this._R},${this._G},${this._B},${alpha})`
borderRadiusElemsStyles.forEach(function (borderRadiusElemStyle, index) {
let oldColor = oldColors[index]
......
......@@ -70,13 +70,6 @@ export function request ({
}
}
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) {
body = data
} else {
......
......@@ -10,21 +10,45 @@ export function isPage () {
export function initRefs (vm) {
const mpInstance = vm.$scope
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] = []
/* eslint-disable no-undef */
const minorVersion = parseInt(tt.getSystemInfoSync().SDKVersion.split('.')[1])
if (minorVersion > 16) {
Object.defineProperty(vm, '$refs', {
get () {
const $refs = {}
const components = mpInstance.selectAllComponents('.vue-ref')
components.forEach(component => {
const ref = component.dataset.ref
$refs[ref] = component.$vm || component
})
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)
......@@ -77,4 +101,4 @@ export function handleLink ({
vm._isMounted = true
vm.__call_hook('mounted')
vm.__call_hook('onReady')
}
}
......@@ -7934,6 +7934,10 @@ shebang-regex@^1.0.0:
version "1.0.0"
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:
version "1.6.1"
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.
先完成此消息的编辑!
想要评论请 注册