提交 3c115ed0 编写于 作者: fxy060608's avatar fxy060608

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

...@@ -6070,7 +6070,7 @@ function createPatchFunction (backend) { ...@@ -6070,7 +6070,7 @@ function createPatchFunction (backend) {
function removeAndInvokeRemoveHook (vnode, rm) { function removeAndInvokeRemoveHook (vnode, rm) {
if (isDef(rm) || isDef(vnode.data)) { if (isDef(rm) || isDef(vnode.data)) {
var i; var i, children;
var listeners = cbs.remove.length + 1; var listeners = cbs.remove.length + 1;
if (isDef(rm)) { if (isDef(rm)) {
// we have a recursively passed down rm callback // we have a recursively passed down rm callback
...@@ -6083,6 +6083,14 @@ function createPatchFunction (backend) { ...@@ -6083,6 +6083,14 @@ function createPatchFunction (backend) {
// recursively invoke hooks on child component root node // recursively invoke hooks on child component root node
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) { if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
removeAndInvokeRemoveHook(i, rm); removeAndInvokeRemoveHook(i, rm);
} else if (isDef(children = vnode.children)) {
// app-plus service 层 elm 暂未实现父子关系维护,移除父 elm 时,导致子 elm 还存留(影响了事件查找)
// 暂时使用 vnode 的 children 递归 rm 掉子 elm
for (i = 0; i < children.length; i++) {
if (children[i].tag) {
removeAndInvokeRemoveHook(children[i]);
}
}
} }
for (i = 0; i < cbs.remove.length; ++i) { for (i = 0; i < cbs.remove.length; ++i) {
cbs.remove[i](vnode, rm); cbs.remove[i](vnode, rm);
......
...@@ -5288,7 +5288,7 @@ function createPatchFunction (backend) { ...@@ -5288,7 +5288,7 @@ function createPatchFunction (backend) {
function removeAndInvokeRemoveHook (vnode, rm) { function removeAndInvokeRemoveHook (vnode, rm) {
if (isDef(rm) || isDef(vnode.data)) { if (isDef(rm) || isDef(vnode.data)) {
var i; var i, children;
var listeners = cbs.remove.length + 1; var listeners = cbs.remove.length + 1;
if (isDef(rm)) { if (isDef(rm)) {
// we have a recursively passed down rm callback // we have a recursively passed down rm callback
...@@ -5301,6 +5301,14 @@ function createPatchFunction (backend) { ...@@ -5301,6 +5301,14 @@ function createPatchFunction (backend) {
// recursively invoke hooks on child component root node // recursively invoke hooks on child component root node
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) { if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
removeAndInvokeRemoveHook(i, rm); removeAndInvokeRemoveHook(i, rm);
} else if (isDef(children = vnode.children)) {
// app-plus service 层 elm 暂未实现父子关系维护,移除父 elm 时,导致子 elm 还存留(影响了事件查找)
// 暂时使用 vnode 的 children 递归 rm 掉子 elm
for (i = 0; i < children.length; i++) {
if (children[i].tag) {
removeAndInvokeRemoveHook(children[i]);
}
}
} }
for (i = 0; i < cbs.remove.length; ++i) { for (i = 0; i < cbs.remove.length; ++i) {
cbs.remove[i](vnode, rm); cbs.remove[i](vnode, rm);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxs getRegExp * wxs getRegExp
*/ */
function getRegExp () { function getRegExp () {
const args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
args.unshift(RegExp); args.unshift(RegExp);
return new (Function.prototype.bind.apply(RegExp, args))() return new (Function.prototype.bind.apply(RegExp, args))()
} }
...@@ -11,7 +11,7 @@ function getRegExp () { ...@@ -11,7 +11,7 @@ function getRegExp () {
* wxs getDate * wxs getDate
*/ */
function getDate () { function getDate () {
const args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
args.unshift(Date); args.unshift(Date);
return new (Function.prototype.bind.apply(Date, args))() return new (Function.prototype.bind.apply(Date, args))()
} }
......
...@@ -132,7 +132,7 @@ const v3 = { ...@@ -132,7 +132,7 @@ const v3 = {
return { return {
devtool, devtool,
mode: process.env.NODE_ENV, mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
externals: { externals: {
vue: 'Vue' vue: 'Vue'
}, },
......
...@@ -268,8 +268,8 @@ if (process.env.UNI_USING_COMPONENTS) { // 是否启用分包优化 ...@@ -268,8 +268,8 @@ if (process.env.UNI_USING_COMPONENTS) { // 是否启用分包优化
const warningMsg = const warningMsg =
usingComponentsAbsent usingComponentsAbsent
? `该应用之前可能是非自定义组件模式,目前以自定义组件模式运行。非自定义组件于2019年11月1日起停止支持。详见:https://ask.dcloud.net.cn/article/36385` ? `该应用之前可能是非自定义组件模式,目前以自定义组件模式运行。非自定义组件于2019年11月1日起停止支持。详见:https://ask.dcloud.net.cn/article/36385`
: `uni-app于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 const needWarning = !platformOptions.usingComponents || usingComponentsAbsent
let hasNVue = false let hasNVue = false
......
...@@ -104,7 +104,7 @@ module.exports = { ...@@ -104,7 +104,7 @@ module.exports = {
return { return {
devtool, devtool,
mode: process.env.NODE_ENV, mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry () { entry () {
return process.UNI_ENTRY return process.UNI_ENTRY
}, },
......
...@@ -41,7 +41,7 @@ var isReady=false;var onReadyCallbacks=[]; ...@@ -41,7 +41,7 @@ var isReady=false;var onReadyCallbacks=[];
var __uniConfig = ${JSON.stringify(appJson, null)}; var __uniConfig = ${JSON.stringify(appJson, null)};
var __uniRoutes = ${JSON.stringify(__uniRoutes)}; var __uniRoutes = ${JSON.stringify(__uniRoutes)};
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes}}}}); service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,window:void 0}}}});
` `
} }
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxs getRegExp * wxs getRegExp
*/ */
export function getRegExp () { export function getRegExp () {
const args = Array.prototype.slice.call(arguments) var args = Array.prototype.slice.call(arguments)
args.unshift(RegExp) args.unshift(RegExp)
return new (Function.prototype.bind.apply(RegExp, args))() return new (Function.prototype.bind.apply(RegExp, args))()
} }
...@@ -11,7 +11,7 @@ export function getRegExp () { ...@@ -11,7 +11,7 @@ export function getRegExp () {
* wxs getDate * wxs getDate
*/ */
export function getDate () { export function getDate () {
const args = Array.prototype.slice.call(arguments) var args = Array.prototype.slice.call(arguments)
args.unshift(Date) args.unshift(Date)
return new (Function.prototype.bind.apply(Date, args))() return new (Function.prototype.bind.apply(Date, args))()
} }
...@@ -121,8 +121,12 @@ export default { ...@@ -121,8 +121,12 @@ export default {
method(data) method(data)
} }
}, },
_resize () { _resize () {
wrapper(this.$refs.canvas) var canvas = this.$refs.canvas
var context = canvas.getContext('2d')
var imageData = context.getImageData(0, 0, canvas.width, canvas.height)
wrapper(this.$refs.canvas)
context.putImageData(imageData, 0, 0)
}, },
_touchmove (event) { _touchmove (event) {
event.preventDefault() event.preventDefault()
......
...@@ -198,12 +198,12 @@ const protocols = { // 需要做转换的 API 列表 ...@@ -198,12 +198,12 @@ const protocols = { // 需要做转换的 API 列表
returnValue: { returnValue: {
apFilePath: 'tempFilePath' apFilePath: 'tempFilePath'
} }
}, },
chooseVideo: { chooseVideo: {
// 支付宝小程序文档中未找到(仅在getSetting处提及),但实际可用 // 支付宝小程序文档中未找到(仅在getSetting处提及),但实际可用
returnValue: { returnValue: {
apFilePath: 'tempFilePath' apFilePath: 'tempFilePath'
} }
}, },
connectSocket: { connectSocket: {
args: { args: {
...@@ -287,22 +287,22 @@ const protocols = { // 需要做转换的 API 列表 ...@@ -287,22 +287,22 @@ const protocols = { // 需要做转换的 API 列表
}, },
scanCode: { scanCode: {
name: 'scan', name: 'scan',
args (fromArgs) { args (fromArgs) {
if (fromArgs.scanType === 'qrCode') { if (fromArgs.scanType === 'qrCode') {
fromArgs.type = 'qr' fromArgs.type = 'qr'
return {
onlyFromCamera: 'hideAlbum'
}
} else if (fromArgs.scanType === 'barCode') {
fromArgs.type = 'bar'
return { return {
onlyFromCamera: 'hideAlbum' onlyFromCamera: 'hideAlbum'
} }
} else if (fromArgs.scanType === 'barCode') { } else {
fromArgs.type = 'bar'
return { return {
onlyFromCamera: 'hideAlbum' scanType: false,
} onlyFromCamera: 'hideAlbum'
} else { }
return {
scanType: false,
onlyFromCamera: 'hideAlbum'
}
} }
}, },
returnValue: { returnValue: {
...@@ -333,8 +333,16 @@ const protocols = { // 需要做转换的 API 列表 ...@@ -333,8 +333,16 @@ const protocols = { // 需要做转换的 API 列表
} }
}, },
getUserInfo: { getUserInfo: {
name: 'getAuthUserInfo', name: my.canIUse('getOpenUserInfo') ? 'getOpenUserInfo' : 'getAuthUserInfo',
returnValue (result) { 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 = { result.userInfo = {
nickName: result.nickName, nickName: result.nickName,
avatarUrl: result.avatar avatarUrl: result.avatar
...@@ -353,18 +361,18 @@ const protocols = { // 需要做转换的 API 列表 ...@@ -353,18 +361,18 @@ const protocols = { // 需要做转换的 API 列表
item.uuid = item.serviceId item.uuid = item.serviceId
}) })
} }
}, },
createBLEConnection: { createBLEConnection: {
name: 'connectBLEDevice', name: 'connectBLEDevice',
args: { args: {
timeout: false timeout: false
} }
}, },
closeBLEConnection: { closeBLEConnection: {
name: 'disconnectBLEDevice' name: 'disconnectBLEDevice'
}, },
onBLEConnectionStateChange: { onBLEConnectionStateChange: {
name: 'onBLEConnectionStateChanged' name: 'onBLEConnectionStateChanged'
}, },
makePhoneCall: { makePhoneCall: {
args: { args: {
...@@ -396,35 +404,35 @@ const protocols = { // 需要做转换的 API 列表 ...@@ -396,35 +404,35 @@ const protocols = { // 需要做转换的 API 列表
returnValue: { returnValue: {
brightness: 'value' brightness: 'value'
} }
}, },
showShareMenu: { showShareMenu: {
name: 'showSharePanel' name: 'showSharePanel'
}, },
hideHomeButton: { hideHomeButton: {
name: 'hideBackHome' name: 'hideBackHome'
}, },
saveImageToPhotosAlbum: { saveImageToPhotosAlbum: {
name: 'saveImage', name: 'saveImage',
args: { args: {
filePath: 'url' filePath: 'url'
} }
}, },
saveVideoToPhotosAlbum: { saveVideoToPhotosAlbum: {
args: { args: {
filePath: 'src' filePath: 'src'
} }
}, },
chooseAddress: { chooseAddress: {
name: 'getAddress', name: 'getAddress',
returnValue (result) { returnValue (result) {
let info = result.result || {} let info = result.result || {}
result.userName = info.fullname result.userName = info.fullname
result.provinceName = info.prov result.provinceName = info.prov
result.cityName = info.city result.cityName = info.city
result.detailInfo = info.address result.detailInfo = info.address
result.telNumber = info.mobilePhone result.telNumber = info.mobilePhone
result.errMsg = result.resultStatus result.errMsg = result.resultStatus
} }
} }
} }
......
...@@ -23,10 +23,11 @@ export default function parseBaseComponent (vueComponentOptions, { ...@@ -23,10 +23,11 @@ export default function parseBaseComponent (vueComponentOptions, {
const options = { const options = {
multipleSlots: true, multipleSlots: true,
addGlobalClass: true addGlobalClass: true,
...(vueOptions.options || {})
} }
if (__PLATFORM__ === 'mp-weixin' || __PLATFORM__ === 'mp-qq') { if (__PLATFORM__ === 'mp-weixin' || __PLATFORM__ === 'mp-qq') {
// 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项 // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
if (vueOptions['mp-weixin'] && vueOptions['mp-weixin']['options']) { if (vueOptions['mp-weixin'] && vueOptions['mp-weixin']['options']) {
Object.assign(options, vueOptions['mp-weixin']['options']) Object.assign(options, vueOptions['mp-weixin']['options'])
...@@ -109,4 +110,4 @@ export default function parseBaseComponent (vueComponentOptions, { ...@@ -109,4 +110,4 @@ export default function parseBaseComponent (vueComponentOptions, {
return componentOptions return componentOptions
} }
return [componentOptions, VueComponent] return [componentOptions, VueComponent]
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册