Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
uni-app
提交
9123bd64
U
uni-app
项目概览
Metz
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9123bd64
编写于
11月 29, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(v3): __wxUsingComponents
上级
c248919d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
45 addition
and
15 deletion
+45
-15
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+14
-3
packages/uni-migration/lib/mp-weixin/transform/script-transformer.js
...i-migration/lib/mp-weixin/transform/script-transformer.js
+1
-1
packages/vue-cli-plugin-uni/lib/app-plus/index.js
packages/vue-cli-plugin-uni/lib/app-plus/index.js
+8
-7
src/core/runtime/mp/index.js
src/core/runtime/mp/index.js
+2
-3
src/core/runtime/mp/parser/component-parser.js
src/core/runtime/mp/parser/component-parser.js
+6
-0
src/core/runtime/mp/parser/components-parser.js
src/core/runtime/mp/parser/components-parser.js
+3
-0
src/platforms/app-plus/service/framework/plugins/lifecycle.js
...platforms/app-plus/service/framework/plugins/lifecycle.js
+11
-1
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
9123bd64
...
...
@@ -4754,7 +4754,7 @@ var serviceContext = (function () {
});
},
indexOf
(
page
)
{
const
itemLength
=
config
.
list
.
length
;
const
itemLength
=
config
&&
config
.
list
&&
config
.
list
.
length
;
if
(
itemLength
)
{
for
(
let
i
=
0
;
i
<
itemLength
;
i
++
)
{
if
(
...
...
@@ -6048,7 +6048,7 @@ var serviceContext = (function () {
hasContentType
=
true
;
headers
[
'
Content-Type
'
]
=
header
[
name
];
// TODO 需要重构
if
(
method
===
'
POST
'
&&
header
[
name
].
indexOf
(
'
application/x-www-form-urlencoded
'
)
===
0
)
{
if
(
method
===
'
POST
'
&&
header
[
name
].
indexOf
(
'
application/x-www-form-urlencoded
'
)
===
0
)
{
let
bodyArray
=
[];
for
(
let
key
in
data
)
{
if
(
data
.
hasOwnProperty
(
key
))
{
...
...
@@ -12288,7 +12288,18 @@ var serviceContext = (function () {
lifecycleMixin
(
Vue
);
Vue
.
mixin
({
beforeCreate
()
{
beforeCreate
()
{
// TODO 临时解决方案,service 层也注入 wxs (适用于工具类)
const
options
=
this
.
$options
;
const
wxs
=
options
.
wxs
;
if
(
wxs
)
{
Object
.
keys
(
wxs
).
forEach
(
module
=>
{
this
[
module
]
=
wxs
[
module
];
});
}
if
(
this
.
mpType
===
'
page
'
)
{
this
.
$scope
=
this
.
$options
.
pageInstance
;
this
.
$scope
.
$vm
=
this
;
...
...
packages/uni-migration/lib/mp-weixin/transform/script-transformer.js
浏览文件 @
9123bd64
...
...
@@ -7,7 +7,7 @@ const {
function
transformScript
(
content
,
route
,
usingComponentsCode
)
{
return
`global['__wxRoute'].push('
${
route
}
')
global['__wxUsingComponents']
=
${
usingComponentsCode
}
global['__wxUsingComponents']
.push(
${
usingComponentsCode
}
)
${
content
}
export default global['__wxComponents']['
${
route
}
']`
}
...
...
packages/vue-cli-plugin-uni/lib/app-plus/index.js
浏览文件 @
9123bd64
...
...
@@ -71,13 +71,14 @@ const v3 = {
'
../../packages/webpack-uni-app-loader/view/script
'
)
}]
})
rules
.
push
({
resourceQuery
:
[
/lang=wxs/
,
/blockType=wxs/
],
use
:
[{
loader
:
path
.
resolve
(
__dirname
,
'
../../packages/webpack-uni-filter-loader
'
)
}]
})
}
}
// TODO 临时方案,将 wxs 也编译至 service
rules
.
push
({
resourceQuery
:
[
/lang=wxs/
,
/blockType=wxs/
],
use
:
[{
loader
:
path
.
resolve
(
__dirname
,
'
../../packages/webpack-uni-filter-loader
'
)
}]
})
const
entry
=
{}
if
(
isAppService
)
{
...
...
src/core/runtime/mp/index.js
浏览文件 @
9123bd64
...
...
@@ -7,13 +7,12 @@ import polyfill from './polyfill'
export
*
from
'
./wxs
'
global
[
'
__wxRoute
'
]
=
[]
global
[
'
__wxComponents
'
]
=
Object
.
create
(
null
)
global
[
'
__wxUsingComponents
'
]
=
[]
export
function
Component
(
options
)
{
const
componentOptions
=
parseComponent
(
options
)
componentOptions
.
mixins
.
unshift
(
polyfill
)
if
(
!
global
[
'
__wxComponents
'
])
{
global
[
'
__wxComponents
'
]
=
Object
.
create
(
null
)
}
global
[
'
__wxComponents
'
][
global
[
'
__wxRoute
'
].
pop
()]
=
componentOptions
}
...
...
src/core/runtime/mp/parser/component-parser.js
浏览文件 @
9123bd64
...
...
@@ -6,6 +6,10 @@ import {
parseProperties
}
from
'
./properties-parser
'
import
{
parseComponents
}
from
'
./components-parser
'
import
{
parseOptions
}
from
'
./options-parser
'
...
...
@@ -68,6 +72,8 @@ export function parseComponent (mpComponentOptions) {
}
}
parseComponents
(
vueComponentOptions
)
parseData
(
data
,
vueComponentOptions
)
parseOptions
(
options
,
vueComponentOptions
)
parseMethods
(
methods
,
vueComponentOptions
)
...
...
src/core/runtime/mp/parser/components-parser.js
0 → 100644
浏览文件 @
9123bd64
export
function
parseComponents
(
vueComponentOptions
)
{
vueComponentOptions
.
components
=
global
[
'
__wxUsingComponents
'
].
pop
()
}
src/platforms/app-plus/service/framework/plugins/lifecycle.js
浏览文件 @
9123bd64
...
...
@@ -49,7 +49,17 @@ export function initLifecycle (Vue) {
lifecycleMixin
(
Vue
)
Vue
.
mixin
({
beforeCreate
()
{
beforeCreate
()
{
// TODO 临时解决方案,service 层也注入 wxs (适用于工具类)
const
options
=
this
.
$options
const
wxs
=
options
.
wxs
if
(
wxs
)
{
Object
.
keys
(
wxs
).
forEach
(
module
=>
{
this
[
module
]
=
wxs
[
module
]
})
}
if
(
this
.
mpType
===
'
page
'
)
{
this
.
$scope
=
this
.
$options
.
pageInstance
this
.
$scope
.
$vm
=
this
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录