提交 aa10af98 编写于 作者: Q qiang

build runtime

上级 61b0d313
......@@ -1314,7 +1314,8 @@ function parseBaseComponent (vueComponentOptions, {
const options = {
multipleSlots: true,
addGlobalClass: true
addGlobalClass: true,
...(vueOptions.options || {})
};
const componentOptions = {
......
......@@ -442,19 +442,32 @@ const protocols = { // 需要做转换的 API 列表
if (!fromArgs.header) { // 默认增加 header 参数,方便格式化 content-type
fromArgs.header = {};
}
return {
header (header = {}, toArgs) {
const headers = {
'content-type': 'application/json'
};
Object.keys(header).forEach(key => {
headers[key.toLocaleLowerCase()] = header[key];
Object.keys(fromArgs.header).forEach(key => {
headers[key.toLocaleLowerCase()] = fromArgs.header[key];
});
return {
header (header = {}, toArgs) {
return {
name: 'headers',
value: headers
}
},
data (data) {
// 钉钉在content-type为application/json时,不会自动序列化
if (my.dd && headers['content-type'].indexOf('application/json') === 0) {
return {
name: 'data',
value: JSON.stringify(data)
}
}
return {
name: 'data',
value: data
}
},
method: 'method', // TODO 支付宝小程序仅支持 get,post
responseType: false
}
......@@ -686,8 +699,16 @@ const protocols = { // 需要做转换的 API 列表
}
},
getUserInfo: {
name: 'getAuthUserInfo',
name: my.canIUse('getOpenUserInfo') ? 'getOpenUserInfo' : 'getAuthUserInfo',
returnValue (result) {
if (my.canIUse('getOpenUserInfo')) {
let response = {};
try {
response = JSON.parse(result.response).response;
} catch (e) {}
result.nickName = response.nickName;
result.avatar = response.avatar;
}
result.userInfo = {
nickName: result.nickName,
avatarUrl: result.avatar
......
......@@ -1448,7 +1448,8 @@ function parseBaseComponent (vueComponentOptions, {
const options = {
multipleSlots: true,
addGlobalClass: true
addGlobalClass: true,
...(vueOptions.options || {})
};
const componentOptions = {
......
......@@ -1366,7 +1366,8 @@ function parseBaseComponent (vueComponentOptions, {
const options = {
multipleSlots: true,
addGlobalClass: true
addGlobalClass: true,
...(vueOptions.options || {})
};
{
......
......@@ -1538,7 +1538,8 @@ function parseBaseComponent (vueComponentOptions, {
const options = {
multipleSlots: true,
addGlobalClass: true
addGlobalClass: true,
...(vueOptions.options || {})
};
const componentOptions = {
......
......@@ -1319,7 +1319,8 @@ function parseBaseComponent (vueComponentOptions, {
const options = {
multipleSlots: true,
addGlobalClass: true
addGlobalClass: true,
...(vueOptions.options || {})
};
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册