提交 1eee2d6b 编写于 作者: fxy060608's avatar fxy060608

Merge branch 'dev' of https://github.com/dcloudio/uni-app into alpha

......@@ -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: {
......
......@@ -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);
......
......@@ -836,7 +836,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,9 +863,6 @@ const lifecycle = {
},
onError(e) {
stat.error(e);
},
onShareAppMessage() {
stat.interceptShare(false);
}
};
......
......@@ -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,9 +36,6 @@ const lifecycle = {
},
onError(e) {
stat.error(e)
},
onShareAppMessage() {
stat.interceptShare(false)
}
}
......
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 升级`)
}
}
}
......@@ -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
}
}
}
}
......@@ -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')
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册