Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MuGuiLin
uni-app
提交
e8cf7689
U
uni-app
项目概览
MuGuiLin
/
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,发现更多精彩内容 >>
提交
e8cf7689
编写于
7月 16, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(app-plus-nvue): add registerConfig
上级
dd8d2210
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
116 addition
and
32 deletion
+116
-32
build/rollup.config.service.js
build/rollup.config.service.js
+2
-1
packages/uni-app-plus-nvue/dist/index.js
packages/uni-app-plus-nvue/dist/index.js
+61
-12
packages/uni-app-plus-nvue/dist/uni.js
packages/uni-app-plus-nvue/dist/uni.js
+1
-1
src/platforms/app-plus-nvue/service/uni/router.js
src/platforms/app-plus-nvue/service/uni/router.js
+0
-0
src/platforms/app-plus/service/uni/app.js
src/platforms/app-plus/service/uni/app.js
+1
-1
src/platforms/app-plus/service/uni/config.js
src/platforms/app-plus/service/uni/config.js
+22
-0
src/platforms/app-plus/service/uni/create-instance-context.js
...platforms/app-plus/service/uni/create-instance-context.js
+27
-15
src/platforms/app-plus/service/uni/page.js
src/platforms/app-plus/service/uni/page.js
+2
-2
未找到文件。
build/rollup.config.service.js
浏览文件 @
e8cf7689
...
...
@@ -16,7 +16,8 @@ if (process.env.UNI_SERVICE === 'legacy') {
}
else
if
(
process
.
env
.
UNI_SERVICE
===
'
uni
'
)
{
input
=
'
src/platforms/app-plus/service/uni/index.js
'
output
.
file
=
'
packages/uni-app-plus-nvue/dist/uni.js
'
output
.
banner
=
'
export function createUniInstance(plus){
\n
'
output
.
banner
=
'
export function createUniInstance(weex, plus, __uniConfig, __uniRoutes, getApp, getCurrentPages){
\n
'
output
.
footer
=
'
\n
return uni$1
\n
}
'
}
...
...
packages/uni-app-plus-nvue/dist/index.js
浏览文件 @
e8cf7689
...
...
@@ -61,28 +61,77 @@ const pageVms = [];
function
getCurrentPages
()
{
return
pageVms
}
/**
* @param {Object} pageVm
*
* page.beforeCreate 时添加 page
* page.beforeDestroy 时移出 page
*
* page.viewappear onShow
* page.viewdisappear onHide
*
* navigateTo
* redirectTo
*
*
*
*
*
*
*/
function
registerPage
(
pageVm
)
{
pageVms
.
push
(
pageVm
);
}
const
__uniConfig
=
Object
.
create
(
null
);
const
__uniRoutes
=
[];
const
uniConfig
=
Object
.
create
(
null
);
const
uniRoutes
=
[];
function
parseRoutes
(
config
)
{
uniRoutes
.
length
=
0
;
/* eslint-disable no-mixed-operators */
const
tabBarList
=
(
config
.
tabBar
&&
config
.
tabBar
.
list
||
[]).
map
(
item
=>
item
.
pagePath
);
Object
.
keys
(
config
.
page
).
forEach
(
function
(
pagePath
)
{
uniRoutes
.
push
({
path
:
'
/
'
+
pagePath
,
meta
:
{
isTabBar
:
tabBarList
.
indexOf
(
pagePath
)
!==
-
1
}
});
});
}
function
registerConfig
(
config
)
{
Object
.
assign
(
uniConfig
,
config
);
parseRoutes
(
uniConfig
);
}
function
createInstanceContext
({
weex
,
WeexPlus
})
{
const
plus
=
new
WeexPlus
(
weex
);
return
{
__uniConfig
,
__uniRoutes
,
__registerApp
(
appVm
,
{
uniConfig
,
uniRoutes
})
{
Object
.
assign
(
__uniConfig
,
uniConfig
);
uniRoutes
.
forEach
(
route
=>
__uniRoutes
.
push
(
route
));
registerApp
(
appVm
,
__uniRoutes
,
plus
);
__uniConfig
:
uniConfig
,
__uniRoutes
:
uniRoutes
,
__registerConfig
(
config
)
{
registerConfig
(
config
);
},
__registerApp
(
appVm
)
{
registerApp
(
appVm
,
uniRoutes
,
plus
);
},
__registerPage
(
pageVm
)
{
registerPage
(
pageVm
);
},
uni
:
createUniInstance
(
plus
),
uni
:
createUniInstance
(
weex
,
plus
,
__uniConfig
,
__uniRoutes
,
getApp
,
getCurrentPages
),
getApp
,
getCurrentPages
}
...
...
packages/uni-app-plus-nvue/dist/uni.js
浏览文件 @
e8cf7689
export
function
createUniInstance
(
plu
s
){
export
function
createUniInstance
(
weex
,
plus
,
__uniConfig
,
__uniRoutes
,
getApp
,
getCurrentPage
s
){
const
_toString
=
Object
.
prototype
.
toString
;
const
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
;
...
...
src/platforms/app-plus-nvue/service/router.js
→
src/platforms/app-plus-nvue/service/
uni/
router.js
浏览文件 @
e8cf7689
文件已移动
src/platforms/app-plus
-nvue/service
/app.js
→
src/platforms/app-plus
/service/uni
/app.js
浏览文件 @
e8cf7689
import
Router
from
'
.
/router
'
import
Router
from
'
uni-platform/service/uni
/router
'
let
appCtx
...
...
src/platforms/app-plus/service/uni/config.js
0 → 100644
浏览文件 @
e8cf7689
export
const
uniConfig
=
Object
.
create
(
null
)
export
const
uniRoutes
=
[]
function
parseRoutes
(
config
)
{
uniRoutes
.
length
=
0
/* eslint-disable no-mixed-operators */
const
tabBarList
=
(
config
.
tabBar
&&
config
.
tabBar
.
list
||
[]).
map
(
item
=>
item
.
pagePath
)
Object
.
keys
(
config
.
page
).
forEach
(
function
(
pagePath
)
{
uniRoutes
.
push
({
path
:
'
/
'
+
pagePath
,
meta
:
{
isTabBar
:
tabBarList
.
indexOf
(
pagePath
)
!==
-
1
}
})
})
}
export
function
registerConfig
(
config
)
{
Object
.
assign
(
uniConfig
,
config
)
parseRoutes
(
uniConfig
)
}
src/platforms/app-plus/service/uni/create-instance-context.js
浏览文件 @
e8cf7689
import
{
getApp
,
registerApp
}
from
'
uni-platform/service
/app
'
}
from
'
.
/app
'
import
{
registerPage
,
getCurrentPages
}
from
'
uni-platform/service/page
'
}
from
'
./page
'
import
{
uniConfig
,
uniRoutes
,
registerConfig
}
from
'
./config
'
import
{
createUniInstance
}
from
'
./uni
'
const
__uniConfig
=
Object
.
create
(
null
)
const
__uniRoutes
=
[]
export
function
createInstanceContext
({
weex
,
WeexPlus
})
{
const
plus
=
new
WeexPlus
(
weex
)
return
{
__uniConfig
,
__uniRoutes
,
__registerApp
(
appVm
,
{
uniConfig
,
uniRoutes
})
{
Object
.
assign
(
__uniConfig
,
uniConfig
)
uniRoutes
.
forEach
(
route
=>
__uniRoutes
.
push
(
route
))
registerApp
(
appVm
,
__uniRoutes
,
plus
)
__uniConfig
:
uniConfig
,
__uniRoutes
:
uniRoutes
,
__registerConfig
(
config
)
{
registerConfig
(
config
)
},
__registerApp
(
appVm
)
{
registerApp
(
appVm
,
uniRoutes
,
plus
)
},
__registerPage
(
pageVm
)
{
registerPage
(
pageVm
)
},
uni
:
createUniInstance
(
plus
),
uni
:
createUniInstance
(
weex
,
plus
,
__uniConfig
,
__uniRoutes
,
getApp
,
getCurrentPages
),
getApp
,
getCurrentPages
}
...
...
src/platforms/app-plus
-nvue/service
/page.js
→
src/platforms/app-plus
/service/uni
/page.js
浏览文件 @
e8cf7689
...
...
@@ -11,7 +11,7 @@ export function getCurrentPages () {
*
* page.viewappear onShow
* page.viewdisappear onHide
*
*
* navigateTo
* redirectTo
*
...
...
@@ -22,5 +22,5 @@ export function getCurrentPages () {
*
*/
export
function
registerPage
(
pageVm
)
{
pageVms
.
push
(
pageVm
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录