Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
07d03bfc
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
717
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
07d03bfc
编写于
3月 25, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
build uni-app-plus
上级
c6528f2e
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
59 addition
and
88 deletion
+59
-88
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/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
浏览文件 @
07d03bfc
...
...
@@ -21,7 +21,7 @@ function hasOwn (obj, key) {
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$/
;
...
...
@@ -228,35 +228,6 @@ TODOS.forEach(function (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
)
{
/* eslint-disable no-undef */
return
__requireNativePlugin__
(
pluginName
)
...
...
@@ -289,13 +260,13 @@ function initHooks (mpOptions, hooks, delay = false) {
});
}
function
getData
(
vueOptions
)
{
function
getData
(
vueOptions
,
context
)
{
let
data
=
vueOptions
.
data
||
{};
const
methods
=
vueOptions
.
methods
||
{};
if
(
typeof
data
===
'
function
'
)
{
try
{
data
=
data
();
data
=
data
.
call
(
context
);
// 支持 Vue.prototype 上挂的数据
}
catch
(
e
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
console
.
warn
(
'
根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。
'
,
data
);
...
...
@@ -561,7 +532,7 @@ const hooks$1 = [
function
createPage
(
vueOptions
)
{
vueOptions
=
vueOptions
.
default
||
vueOptions
;
const
pageOptions
=
{
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
onLoad
(
args
)
{
this
.
$vm
=
new
Vue
(
Object
.
assign
(
vueOptions
,
{
...
...
@@ -570,7 +541,7 @@ function createPage (vueOptions) {
}));
this
.
$vm
.
__call_hook
(
'
created
'
);
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
);
// 开发者
一般可能会在 onLoad 时赋值,所以
提前到 mount 之前
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
);
// 开发者
可能会在 onLoad 时赋值,
提前到 mount 之前
this
.
$vm
.
$mount
();
},
onReady
()
{
...
...
@@ -615,6 +586,9 @@ function initVueComponent (mpInstace, VueComponent, extraOptions = {}) {
});
mpInstace
.
$vm
.
$scopedSlots
=
mpInstace
.
$vm
.
$slots
=
$slots
;
}
// 性能优先,mount 提前到 attached 中,保证组件首次渲染数据被合并
// 导致与标准 Vue 的差异,data 和 computed 中不能使用$parent,provide等组件属性
mpInstace
.
$vm
.
$mount
();
}
function
createComponent
(
vueOptions
)
{
...
...
@@ -629,7 +603,7 @@ function createComponent (vueOptions) {
multipleSlots
:
true
,
addGlobalClass
:
true
},
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
properties
,
lifetimes
:
{
attached
()
{
...
...
@@ -639,9 +613,9 @@ function createComponent (vueOptions) {
initVueComponent
(
this
,
VueComponent
);
// 目前发现部分情况小程序 attached 不触发
triggerLink
(
this
);
// 处理 parent,children
//
初始化渲染数据(需要等 parent,inject 都初始化完成,否则可以放到 attached 里边初始化渲染)
//
补充生命周期
this
.
$vm
.
__call_hook
(
'
created
'
);
this
.
$vm
.
$mount
(
);
this
.
$vm
.
__call_hook
(
'
beforeMount
'
);
this
.
$vm
.
_isMounted
=
true
;
this
.
$vm
.
__call_hook
(
'
mounted
'
);
this
.
$vm
.
__call_hook
(
'
onReady
'
);
...
...
@@ -681,12 +655,6 @@ if (typeof Proxy !== 'undefined') {
if
(
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
))
{
return
}
...
...
@@ -696,14 +664,6 @@ if (typeof Proxy !== 'undefined') {
}
else
{
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
=>
{
uni
[
name
]
=
promisify
(
name
,
api
[
name
]);
});
...
...
packages/uni-app-plus/package.json
浏览文件 @
07d03bfc
{
"name"
:
"@dcloudio/uni-app-plus"
,
"version"
:
"0.0.20
2
"
,
"version"
:
"0.0.20
4
"
,
"description"
:
"uni-app app-plus"
,
"main"
:
"dist/index.js"
,
"scripts"
:
{
...
...
packages/uni-mp-weixin/dist/index.js
浏览文件 @
07d03bfc
...
...
@@ -21,7 +21,7 @@ function hasOwn (obj, key) {
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$/
;
...
...
@@ -291,13 +291,13 @@ function initHooks (mpOptions, hooks, delay = false) {
});
}
function
getData
(
vueOptions
)
{
function
getData
(
vueOptions
,
context
)
{
let
data
=
vueOptions
.
data
||
{};
const
methods
=
vueOptions
.
methods
||
{};
if
(
typeof
data
===
'
function
'
)
{
try
{
data
=
data
();
data
=
data
.
call
(
context
);
// 支持 Vue.prototype 上挂的数据
}
catch
(
e
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
console
.
warn
(
'
根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。
'
,
data
);
...
...
@@ -563,7 +563,7 @@ const hooks$1 = [
function
createPage
(
vueOptions
)
{
vueOptions
=
vueOptions
.
default
||
vueOptions
;
const
pageOptions
=
{
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
onLoad
(
args
)
{
this
.
$vm
=
new
Vue
(
Object
.
assign
(
vueOptions
,
{
...
...
@@ -572,7 +572,7 @@ function createPage (vueOptions) {
}));
this
.
$vm
.
__call_hook
(
'
created
'
);
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
);
// 开发者
一般可能会在 onLoad 时赋值,所以
提前到 mount 之前
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
);
// 开发者
可能会在 onLoad 时赋值,
提前到 mount 之前
this
.
$vm
.
$mount
();
},
onReady
()
{
...
...
@@ -634,7 +634,7 @@ function createComponent (vueOptions) {
multipleSlots
:
true
,
addGlobalClass
:
true
},
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
properties
,
lifetimes
:
{
attached
()
{
...
...
@@ -686,9 +686,11 @@ if (typeof Proxy !== 'undefined') {
if
(
api
[
name
])
{
return
promisify
(
name
,
api
[
name
])
}
{
if
(
extraApi
[
name
])
{
return
promisify
(
name
,
extraApi
[
name
])
}
}
if
(
todoApis
[
name
])
{
return
promisify
(
name
,
todoApis
[
name
])
}
...
...
@@ -705,9 +707,11 @@ if (typeof Proxy !== 'undefined') {
uni
[
name
]
=
promisify
(
name
,
todoApis
[
name
]);
});
{
Object
.
keys
(
extraApi
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
todoApis
[
name
]);
});
}
Object
.
keys
(
api
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
api
[
name
]);
...
...
packages/uni-mp-weixin/package.json
浏览文件 @
07d03bfc
{
"name"
:
"@dcloudio/uni-mp-weixin"
,
"version"
:
"0.0.91
3
"
,
"version"
:
"0.0.91
4
"
,
"description"
:
"uni-app mp-weixin"
,
"main"
:
"dist/index.js"
,
"scripts"
:
{
...
...
src/core/helpers/promise.js
浏览文件 @
07d03bfc
...
...
@@ -2,7 +2,7 @@ import {
isFn
}
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$/
...
...
src/core/runtime/index.js
浏览文件 @
07d03bfc
...
...
@@ -31,12 +31,14 @@ if (typeof Proxy !== 'undefined') {
if
(
api
[
name
])
{
return
promisify
(
name
,
api
[
name
])
}
if
(
__PLATFORM__
!==
'
app-plus
'
)
{
if
(
extraApi
[
name
])
{
return
promisify
(
name
,
extraApi
[
name
])
}
if
(
todoApi
[
name
])
{
return
promisify
(
name
,
todoApi
[
name
])
}
}
if
(
!
hasOwn
(
__GLOBAL__
,
name
)
&&
!
hasOwn
(
protocols
,
name
))
{
return
}
...
...
@@ -46,13 +48,14 @@ if (typeof Proxy !== 'undefined') {
}
else
{
uni
.
upx2px
=
upx2px
if
(
__PLATFORM__
!==
'
app-plus
'
)
{
Object
.
keys
(
todoApi
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
todoApi
[
name
])
})
Object
.
keys
(
extraApi
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
todoApi
[
name
])
})
}
Object
.
keys
(
api
).
forEach
(
name
=>
{
uni
[
name
]
=
promisify
(
name
,
api
[
name
])
...
...
src/core/runtime/wrapper/create-component.js
浏览文件 @
07d03bfc
...
...
@@ -50,7 +50,7 @@ export function createComponent (vueOptions) {
multipleSlots
:
true
,
addGlobalClass
:
true
},
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
properties
,
lifetimes
:
{
attached
()
{
...
...
src/core/runtime/wrapper/create-page.js
浏览文件 @
07d03bfc
...
...
@@ -30,7 +30,7 @@ const hooks = [
export
function
createPage
(
vueOptions
)
{
vueOptions
=
vueOptions
.
default
||
vueOptions
const
pageOptions
=
{
data
:
getData
(
vueOptions
),
data
:
getData
(
vueOptions
,
Vue
.
prototype
),
onLoad
(
args
)
{
if
(
__PLATFORM__
===
'
mp-baidu
'
)
{
this
.
$baiduComponentInstances
=
Object
.
create
(
null
)
...
...
@@ -42,7 +42,7 @@ export function createPage (vueOptions) {
}))
this
.
$vm
.
__call_hook
(
'
created
'
)
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
)
// 开发者
一般可能会在 onLoad 时赋值,所以
提前到 mount 之前
this
.
$vm
.
__call_hook
(
'
onLoad
'
,
args
)
// 开发者
可能会在 onLoad 时赋值,
提前到 mount 之前
this
.
$vm
.
$mount
()
},
onReady
()
{
...
...
src/core/runtime/wrapper/util.js
浏览文件 @
07d03bfc
...
...
@@ -28,13 +28,13 @@ export function initHooks (mpOptions, hooks, delay = false) {
})
}
export
function
getData
(
vueOptions
)
{
export
function
getData
(
vueOptions
,
context
)
{
let
data
=
vueOptions
.
data
||
{}
const
methods
=
vueOptions
.
methods
||
{}
if
(
typeof
data
===
'
function
'
)
{
try
{
data
=
data
()
data
=
data
.
call
(
context
)
// 支持 Vue.prototype 上挂的数据
}
catch
(
e
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
console
.
warn
(
'
根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。
'
,
data
)
...
...
src/platforms/app-plus/service/api/require-native-plugin.js
0 → 100644
浏览文件 @
07d03bfc
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录