Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
anyefeiyu
uni-app
提交
86e16f4f
U
uni-app
项目概览
anyefeiyu
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
86e16f4f
编写于
3月 27, 2019
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of github.com:dcloudio/uni-app into dev
上级
7be05819
1bdc9fc6
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
69 addition
and
90 deletion
+69
-90
packages/uni-app-plus/dist/index.js
packages/uni-app-plus/dist/index.js
+12
-52
packages/uni-app-plus/package.json
packages/uni-app-plus/package.json
+1
-1
packages/uni-mp-weixin/dist/index.js
packages/uni-mp-weixin/dist/index.js
+17
-13
packages/uni-mp-weixin/package.json
packages/uni-mp-weixin/package.json
+1
-1
src/core/helpers/promise.js
src/core/helpers/promise.js
+1
-1
src/core/runtime/index.js
src/core/runtime/index.js
+18
-15
src/core/runtime/wrapper/create-component.js
src/core/runtime/wrapper/create-component.js
+1
-1
src/core/runtime/wrapper/create-page.js
src/core/runtime/wrapper/create-page.js
+2
-2
src/core/runtime/wrapper/util.js
src/core/runtime/wrapper/util.js
+2
-2
src/core/service/api/media/get-image-info.js
src/core/service/api/media/get-image-info.js
+10
-2
src/platforms/app-plus/service/api/require-native-plugin.js
src/platforms/app-plus/service/api/require-native-plugin.js
+4
-0
未找到文件。
packages/uni-app-plus/dist/index.js
浏览文件 @
86e16f4f
...
@@ -21,7 +21,7 @@ function hasOwn (obj, key) {
...
@@ -21,7 +21,7 @@ function hasOwn (obj, key) {
function
noop
()
{}
function
noop
()
{}
const
SYNC_API_RE
=
/
hideKeyboard|upx2px
|canIUse|^create|Sync$|Manager$/
;
const
SYNC_API_RE
=
/
requireNativePlugin|upx2px|hideKeyboard
|canIUse|^create|Sync$|Manager$/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
@@ -228,35 +228,6 @@ TODOS.forEach(function (name) {
...
@@ -228,35 +228,6 @@ TODOS.forEach(function (name) {
todoApis
[
name
]
=
createTodoApi
(
name
);
todoApis
[
name
]
=
createTodoApi
(
name
);
});
});
var
providers
=
{};
function
getProvider
({
service
,
success
,
fail
,
complete
})
{
let
res
=
false
;
if
(
providers
[
service
])
{
res
=
{
errMsg
:
'
getProvider:ok
'
,
service
,
provider
:
providers
[
service
]
};
isFn
(
success
)
&&
success
(
res
);
}
else
{
res
=
{
errMsg
:
'
getProvider:fail:服务[
'
+
service
+
'
]不存在
'
};
isFn
(
fail
)
&&
fail
(
res
);
}
isFn
(
complete
)
&&
complete
(
res
);
}
var
extraApi
=
/*#__PURE__*/
Object
.
freeze
({
getProvider
:
getProvider
});
function
requireNativePlugin
(
pluginName
)
{
function
requireNativePlugin
(
pluginName
)
{
/* eslint-disable no-undef */
/* eslint-disable no-undef */
return
__requireNativePlugin__
(
pluginName
)
return
__requireNativePlugin__
(
pluginName
)
...
@@ -289,13 +260,13 @@ function initHooks (mpOptions, hooks, delay = false) {
...
@@ -289,13 +260,13 @@ function initHooks (mpOptions, hooks, delay = false) {
});
});
}
}
function
getData
(
vueOptions
)
{
function
getData
(
vueOptions
,
context
)
{
let
data
=
vueOptions
.
data
||
{};
let
data
=
vueOptions
.
data
||
{};
const
methods
=
vueOptions
.
methods
||
{};
const
methods
=
vueOptions
.
methods
||
{};
if
(
typeof
data
===
'
function
'
)
{
if
(
typeof
data
===
'
function
'
)
{
try
{
try
{
data
=
data
();
data
=
data
.
call
(
context
);
// 支持 Vue.prototype 上挂的数据
}
catch
(
e
)
{
}
catch
(
e
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
console
.
warn
(
'
根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。
'
,
data
);
console
.
warn
(
'
根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。
'
,
data
);
...
@@ -561,7 +532,7 @@ const hooks$1 = [
...
@@ -561,7 +532,7 @@ const hooks$1 = [
function
createPage
(
vueOptions
)
{
function
createPage
(
vueOptions
)
{
vueOptions
=
vueOptions
.
default
||
vueOptions
;
vueOptions
=
vueOptions
.
default
||
vueOptions
;
const
pageOptions
=
{
const
pageOptions
=
{
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
onLoad
(
args
)
{
onLoad
(
args
)
{
this
.
$vm
=
new
Vue
(
Object
.
assign
(
vueOptions
,
{
this
.
$vm
=
new
Vue
(
Object
.
assign
(
vueOptions
,
{
...
@@ -570,7 +541,7 @@ function createPage (vueOptions) {
...
@@ -570,7 +541,7 @@ function createPage (vueOptions) {
}));
}));
this
.
$vm
.
__call_hook
(
'
created
'
);
this
.
$vm
.
__call_hook
(
'
created
'
);
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
);
// 开发者
一般可能会在 onLoad 时赋值,所以
提前到 mount 之前
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
);
// 开发者
可能会在 onLoad 时赋值,
提前到 mount 之前
this
.
$vm
.
$mount
();
this
.
$vm
.
$mount
();
},
},
onReady
()
{
onReady
()
{
...
@@ -615,6 +586,9 @@ function initVueComponent (mpInstace, VueComponent, extraOptions = {}) {
...
@@ -615,6 +586,9 @@ function initVueComponent (mpInstace, VueComponent, extraOptions = {}) {
});
});
mpInstace
.
$vm
.
$scopedSlots
=
mpInstace
.
$vm
.
$slots
=
$slots
;
mpInstace
.
$vm
.
$scopedSlots
=
mpInstace
.
$vm
.
$slots
=
$slots
;
}
}
// 性能优先,mount 提前到 attached 中,保证组件首次渲染数据被合并
// 导致与标准 Vue 的差异,data 和 computed 中不能使用$parent,provide等组件属性
mpInstace
.
$vm
.
$mount
();
}
}
function
createComponent
(
vueOptions
)
{
function
createComponent
(
vueOptions
)
{
...
@@ -629,7 +603,7 @@ function createComponent (vueOptions) {
...
@@ -629,7 +603,7 @@ function createComponent (vueOptions) {
multipleSlots
:
true
,
multipleSlots
:
true
,
addGlobalClass
:
true
addGlobalClass
:
true
},
},
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
properties
,
properties
,
lifetimes
:
{
lifetimes
:
{
attached
()
{
attached
()
{
...
@@ -639,9 +613,9 @@ function createComponent (vueOptions) {
...
@@ -639,9 +613,9 @@ function createComponent (vueOptions) {
initVueComponent
(
this
,
VueComponent
);
// 目前发现部分情况小程序 attached 不触发
initVueComponent
(
this
,
VueComponent
);
// 目前发现部分情况小程序 attached 不触发
triggerLink
(
this
);
// 处理 parent,children
triggerLink
(
this
);
// 处理 parent,children
//
初始化渲染数据(需要等 parent,inject 都初始化完成,否则可以放到 attached 里边初始化渲染)
//
补充生命周期
this
.
$vm
.
__call_hook
(
'
created
'
);
this
.
$vm
.
__call_hook
(
'
created
'
);
this
.
$vm
.
$mount
(
);
this
.
$vm
.
__call_hook
(
'
beforeMount
'
);
this
.
$vm
.
_isMounted
=
true
;
this
.
$vm
.
_isMounted
=
true
;
this
.
$vm
.
__call_hook
(
'
mounted
'
);
this
.
$vm
.
__call_hook
(
'
mounted
'
);
this
.
$vm
.
__call_hook
(
'
onReady
'
);
this
.
$vm
.
__call_hook
(
'
onReady
'
);
...
@@ -680,13 +654,7 @@ if (typeof Proxy !== 'undefined') {
...
@@ -680,13 +654,7 @@ if (typeof Proxy !== 'undefined') {
}
}
if
(
api
[
name
])
{
if
(
api
[
name
])
{
return
promisify
(
name
,
api
[
name
])
return
promisify
(
name
,
api
[
name
])
}
}
if
(
extraApi
[
name
])
{
return
promisify
(
name
,
extraApi
[
name
])
}
if
(
todoApis
[
name
])
{
return
promisify
(
name
,
todoApis
[
name
])
}
if
(
!
hasOwn
(
wx
,
name
)
&&
!
hasOwn
(
protocols
,
name
))
{
if
(
!
hasOwn
(
wx
,
name
)
&&
!
hasOwn
(
protocols
,
name
))
{
return
return
}
}
...
@@ -696,14 +664,6 @@ if (typeof Proxy !== 'undefined') {
...
@@ -696,14 +664,6 @@ if (typeof Proxy !== 'undefined') {
}
else
{
}
else
{
uni
.
upx2px
=
upx2px
;
uni
.
upx2px
=
upx2px
;
Object
.
keys
(
todoApis
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
todoApis
[
name
]);
});
Object
.
keys
(
extraApi
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
todoApis
[
name
]);
});
Object
.
keys
(
api
).
forEach
(
name
=>
{
Object
.
keys
(
api
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
api
[
name
]);
uni
[
name
]
=
promisify
(
name
,
api
[
name
]);
});
});
...
...
packages/uni-app-plus/package.json
浏览文件 @
86e16f4f
{
{
"name"
:
"@dcloudio/uni-app-plus"
,
"name"
:
"@dcloudio/uni-app-plus"
,
"version"
:
"0.0.20
2
"
,
"version"
:
"0.0.20
4
"
,
"description"
:
"uni-app app-plus"
,
"description"
:
"uni-app app-plus"
,
"main"
:
"dist/index.js"
,
"main"
:
"dist/index.js"
,
"scripts"
:
{
"scripts"
:
{
...
...
packages/uni-mp-weixin/dist/index.js
浏览文件 @
86e16f4f
...
@@ -21,7 +21,7 @@ function hasOwn (obj, key) {
...
@@ -21,7 +21,7 @@ function hasOwn (obj, key) {
function
noop
()
{}
function
noop
()
{}
const
SYNC_API_RE
=
/
hideKeyboard|upx2px
|canIUse|^create|Sync$|Manager$/
;
const
SYNC_API_RE
=
/
requireNativePlugin|upx2px|hideKeyboard
|canIUse|^create|Sync$|Manager$/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
@@ -291,13 +291,13 @@ function initHooks (mpOptions, hooks, delay = false) {
...
@@ -291,13 +291,13 @@ function initHooks (mpOptions, hooks, delay = false) {
});
});
}
}
function
getData
(
vueOptions
)
{
function
getData
(
vueOptions
,
context
)
{
let
data
=
vueOptions
.
data
||
{};
let
data
=
vueOptions
.
data
||
{};
const
methods
=
vueOptions
.
methods
||
{};
const
methods
=
vueOptions
.
methods
||
{};
if
(
typeof
data
===
'
function
'
)
{
if
(
typeof
data
===
'
function
'
)
{
try
{
try
{
data
=
data
();
data
=
data
.
call
(
context
);
// 支持 Vue.prototype 上挂的数据
}
catch
(
e
)
{
}
catch
(
e
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
console
.
warn
(
'
根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。
'
,
data
);
console
.
warn
(
'
根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。
'
,
data
);
...
@@ -563,7 +563,7 @@ const hooks$1 = [
...
@@ -563,7 +563,7 @@ const hooks$1 = [
function
createPage
(
vueOptions
)
{
function
createPage
(
vueOptions
)
{
vueOptions
=
vueOptions
.
default
||
vueOptions
;
vueOptions
=
vueOptions
.
default
||
vueOptions
;
const
pageOptions
=
{
const
pageOptions
=
{
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
onLoad
(
args
)
{
onLoad
(
args
)
{
this
.
$vm
=
new
Vue
(
Object
.
assign
(
vueOptions
,
{
this
.
$vm
=
new
Vue
(
Object
.
assign
(
vueOptions
,
{
...
@@ -572,7 +572,7 @@ function createPage (vueOptions) {
...
@@ -572,7 +572,7 @@ function createPage (vueOptions) {
}));
}));
this
.
$vm
.
__call_hook
(
'
created
'
);
this
.
$vm
.
__call_hook
(
'
created
'
);
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
);
// 开发者
一般可能会在 onLoad 时赋值,所以
提前到 mount 之前
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
);
// 开发者
可能会在 onLoad 时赋值,
提前到 mount 之前
this
.
$vm
.
$mount
();
this
.
$vm
.
$mount
();
},
},
onReady
()
{
onReady
()
{
...
@@ -634,7 +634,7 @@ function createComponent (vueOptions) {
...
@@ -634,7 +634,7 @@ function createComponent (vueOptions) {
multipleSlots
:
true
,
multipleSlots
:
true
,
addGlobalClass
:
true
addGlobalClass
:
true
},
},
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
properties
,
properties
,
lifetimes
:
{
lifetimes
:
{
attached
()
{
attached
()
{
...
@@ -685,9 +685,11 @@ if (typeof Proxy !== 'undefined') {
...
@@ -685,9 +685,11 @@ if (typeof Proxy !== 'undefined') {
}
}
if
(
api
[
name
])
{
if
(
api
[
name
])
{
return
promisify
(
name
,
api
[
name
])
return
promisify
(
name
,
api
[
name
])
}
}
if
(
extraApi
[
name
])
{
{
return
promisify
(
name
,
extraApi
[
name
])
if
(
extraApi
[
name
])
{
return
promisify
(
name
,
extraApi
[
name
])
}
}
}
if
(
todoApis
[
name
])
{
if
(
todoApis
[
name
])
{
return
promisify
(
name
,
todoApis
[
name
])
return
promisify
(
name
,
todoApis
[
name
])
...
@@ -704,10 +706,12 @@ if (typeof Proxy !== 'undefined') {
...
@@ -704,10 +706,12 @@ if (typeof Proxy !== 'undefined') {
Object
.
keys
(
todoApis
).
forEach
(
name
=>
{
Object
.
keys
(
todoApis
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
todoApis
[
name
]);
uni
[
name
]
=
promisify
(
name
,
todoApis
[
name
]);
});
});
Object
.
keys
(
extraApi
).
forEach
(
name
=>
{
{
uni
[
name
]
=
promisify
(
name
,
todoApis
[
name
]);
Object
.
keys
(
extraApi
).
forEach
(
name
=>
{
});
uni
[
name
]
=
promisify
(
name
,
todoApis
[
name
]);
});
}
Object
.
keys
(
api
).
forEach
(
name
=>
{
Object
.
keys
(
api
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
api
[
name
]);
uni
[
name
]
=
promisify
(
name
,
api
[
name
]);
...
...
packages/uni-mp-weixin/package.json
浏览文件 @
86e16f4f
{
{
"name"
:
"@dcloudio/uni-mp-weixin"
,
"name"
:
"@dcloudio/uni-mp-weixin"
,
"version"
:
"0.0.91
3
"
,
"version"
:
"0.0.91
4
"
,
"description"
:
"uni-app mp-weixin"
,
"description"
:
"uni-app mp-weixin"
,
"main"
:
"dist/index.js"
,
"main"
:
"dist/index.js"
,
"scripts"
:
{
"scripts"
:
{
...
...
src/core/helpers/promise.js
浏览文件 @
86e16f4f
...
@@ -2,7 +2,7 @@ import {
...
@@ -2,7 +2,7 @@ import {
isFn
isFn
}
from
'
uni-shared
'
}
from
'
uni-shared
'
const
SYNC_API_RE
=
/
hideKeyboard|upx2px
|canIUse|^create|Sync$|Manager$/
const
SYNC_API_RE
=
/
requireNativePlugin|upx2px|hideKeyboard
|canIUse|^create|Sync$|Manager$/
const
CONTEXT_API_RE
=
/^create|Manager$/
const
CONTEXT_API_RE
=
/^create|Manager$/
...
...
src/core/runtime/index.js
浏览文件 @
86e16f4f
...
@@ -13,8 +13,8 @@ import {
...
@@ -13,8 +13,8 @@ import {
import
wrapper
from
'
./wrapper
'
import
wrapper
from
'
./wrapper
'
import
todoApi
from
'
./todo
'
import
todoApi
from
'
./todo
'
import
*
as
extraApi
from
'
./extra
'
import
*
as
extraApi
from
'
./extra
'
import
*
as
api
from
'
uni-platform/service/api/index.js
'
import
*
as
api
from
'
uni-platform/service/api/index.js
'
...
@@ -30,12 +30,14 @@ if (typeof Proxy !== 'undefined') {
...
@@ -30,12 +30,14 @@ if (typeof Proxy !== 'undefined') {
}
}
if
(
api
[
name
])
{
if
(
api
[
name
])
{
return
promisify
(
name
,
api
[
name
])
return
promisify
(
name
,
api
[
name
])
}
}
if
(
extraApi
[
name
])
{
if
(
__PLATFORM__
!==
'
app-plus
'
)
{
return
promisify
(
name
,
extraApi
[
name
])
if
(
extraApi
[
name
])
{
}
return
promisify
(
name
,
extraApi
[
name
])
if
(
todoApi
[
name
])
{
}
return
promisify
(
name
,
todoApi
[
name
])
if
(
todoApi
[
name
])
{
return
promisify
(
name
,
todoApi
[
name
])
}
}
}
if
(
!
hasOwn
(
__GLOBAL__
,
name
)
&&
!
hasOwn
(
protocols
,
name
))
{
if
(
!
hasOwn
(
__GLOBAL__
,
name
)
&&
!
hasOwn
(
protocols
,
name
))
{
return
return
...
@@ -46,13 +48,14 @@ if (typeof Proxy !== 'undefined') {
...
@@ -46,13 +48,14 @@ if (typeof Proxy !== 'undefined') {
}
else
{
}
else
{
uni
.
upx2px
=
upx2px
uni
.
upx2px
=
upx2px
Object
.
keys
(
todoApi
).
forEach
(
name
=>
{
if
(
__PLATFORM__
!==
'
app-plus
'
)
{
uni
[
name
]
=
promisify
(
name
,
todoApi
[
name
])
Object
.
keys
(
todoApi
).
forEach
(
name
=>
{
})
uni
[
name
]
=
promisify
(
name
,
todoApi
[
name
])
})
Object
.
keys
(
extraApi
).
forEach
(
name
=>
{
Object
.
keys
(
extraApi
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
todoApi
[
name
])
uni
[
name
]
=
promisify
(
name
,
todoApi
[
name
])
})
})
}
Object
.
keys
(
api
).
forEach
(
name
=>
{
Object
.
keys
(
api
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
api
[
name
])
uni
[
name
]
=
promisify
(
name
,
api
[
name
])
...
...
src/core/runtime/wrapper/create-component.js
浏览文件 @
86e16f4f
...
@@ -50,7 +50,7 @@ export function createComponent (vueOptions) {
...
@@ -50,7 +50,7 @@ export function createComponent (vueOptions) {
multipleSlots
:
true
,
multipleSlots
:
true
,
addGlobalClass
:
true
addGlobalClass
:
true
},
},
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
properties
,
properties
,
lifetimes
:
{
lifetimes
:
{
attached
()
{
attached
()
{
...
...
src/core/runtime/wrapper/create-page.js
浏览文件 @
86e16f4f
...
@@ -30,7 +30,7 @@ const hooks = [
...
@@ -30,7 +30,7 @@ const hooks = [
export
function
createPage
(
vueOptions
)
{
export
function
createPage
(
vueOptions
)
{
vueOptions
=
vueOptions
.
default
||
vueOptions
vueOptions
=
vueOptions
.
default
||
vueOptions
const
pageOptions
=
{
const
pageOptions
=
{
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
onLoad
(
args
)
{
onLoad
(
args
)
{
if
(
__PLATFORM__
===
'
mp-baidu
'
)
{
if
(
__PLATFORM__
===
'
mp-baidu
'
)
{
this
.
$baiduComponentInstances
=
Object
.
create
(
null
)
this
.
$baiduComponentInstances
=
Object
.
create
(
null
)
...
@@ -42,7 +42,7 @@ export function createPage (vueOptions) {
...
@@ -42,7 +42,7 @@ export function createPage (vueOptions) {
}))
}))
this
.
$vm
.
__call_hook
(
'
created
'
)
this
.
$vm
.
__call_hook
(
'
created
'
)
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
)
// 开发者
一般可能会在 onLoad 时赋值,所以
提前到 mount 之前
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
)
// 开发者
可能会在 onLoad 时赋值,
提前到 mount 之前
this
.
$vm
.
$mount
()
this
.
$vm
.
$mount
()
},
},
onReady
()
{
onReady
()
{
...
...
src/core/runtime/wrapper/util.js
浏览文件 @
86e16f4f
...
@@ -28,13 +28,13 @@ export function initHooks (mpOptions, hooks, delay = false) {
...
@@ -28,13 +28,13 @@ export function initHooks (mpOptions, hooks, delay = false) {
})
})
}
}
export
function
getData
(
vueOptions
)
{
export
function
getData
(
vueOptions
,
context
)
{
let
data
=
vueOptions
.
data
||
{}
let
data
=
vueOptions
.
data
||
{}
const
methods
=
vueOptions
.
methods
||
{}
const
methods
=
vueOptions
.
methods
||
{}
if
(
typeof
data
===
'
function
'
)
{
if
(
typeof
data
===
'
function
'
)
{
try
{
try
{
data
=
data
()
data
=
data
.
call
(
context
)
// 支持 Vue.prototype 上挂的数据
}
catch
(
e
)
{
}
catch
(
e
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
console
.
warn
(
'
根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。
'
,
data
)
console
.
warn
(
'
根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。
'
,
data
)
...
...
src/core/service/api/media/get-image-info.js
浏览文件 @
86e16f4f
import
getRealPath
from
'
uni-platform/helpers/get-real-path
'
function
_getServiceAddress
()
{
return
window
.
location
.
protocol
+
'
//
'
+
window
.
location
.
host
}
export
function
getImageInfo
({
export
function
getImageInfo
({
src
src
},
callbackId
)
{
},
callbackId
)
{
...
@@ -5,11 +11,13 @@ export function getImageInfo ({
...
@@ -5,11 +11,13 @@ export function getImageInfo ({
invokeCallbackHandler
:
invoke
invokeCallbackHandler
:
invoke
}
=
UniServiceJSBridge
}
=
UniServiceJSBridge
const
img
=
new
Image
()
const
img
=
new
Image
()
const
realPath
=
getRealPath
(
src
)
img
.
onload
=
function
()
{
img
.
onload
=
function
()
{
invoke
(
callbackId
,
{
invoke
(
callbackId
,
{
errMsg
:
'
getImageInfo:ok
'
,
errMsg
:
'
getImageInfo:ok
'
,
width
:
img
.
naturalWidth
,
width
:
img
.
naturalWidth
,
height
:
img
.
naturalHeight
height
:
img
.
naturalHeight
,
path
:
realPath
.
indexOf
(
'
/
'
)
===
0
?
_getServiceAddress
()
+
realPath
:
realPath
})
})
}
}
img
.
onerror
=
function
(
e
)
{
img
.
onerror
=
function
(
e
)
{
...
@@ -18,4 +26,4 @@ export function getImageInfo ({
...
@@ -18,4 +26,4 @@ export function getImageInfo ({
})
})
}
}
img
.
src
=
src
img
.
src
=
src
}
}
src/platforms/app-plus/service/api/require-native-plugin.js
0 → 100644
浏览文件 @
86e16f4f
export
default
function
requireNativePlugin
(
pluginName
)
{
/* eslint-disable no-undef */
return
__requireNativePlugin__
(
pluginName
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录