Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
良好的行为成为习惯
uni-app
提交
43e71a9f
U
uni-app
项目概览
良好的行为成为习惯
/
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,发现更多精彩内容 >>
提交
43e71a9f
编写于
12月 20, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(cli): init auto import components options
上级
a7509f97
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
15 deletion
+22
-15
packages/uni-cli-shared/lib/pages.js
packages/uni-cli-shared/lib/pages.js
+15
-2
packages/vue-cli-plugin-uni/lib/env.js
packages/vue-cli-plugin-uni/lib/env.js
+6
-0
packages/webpack-uni-pages-loader/lib/index-new.js
packages/webpack-uni-pages-loader/lib/index-new.js
+1
-13
未找到文件。
packages/uni-cli-shared/lib/pages.js
浏览文件 @
43e71a9f
...
@@ -328,6 +328,19 @@ function addPageUsingComponents (pagePath, usingComponents) {
...
@@ -328,6 +328,19 @@ function addPageUsingComponents (pagePath, usingComponents) {
// 存储自动组件
// 存储自动组件
const
autoComponentMap
=
{}
const
autoComponentMap
=
{}
let
lastUsingAutoImportComponentsJson
=
''
process
.
UNI_AUTO_COMPONENTS
=
[]
function
initAutoImportComponents
(
usingAutoImportComponents
=
{})
{
const
newUsingAutoImportComponentsJson
=
JSON
.
stringify
(
usingAutoImportComponents
)
if
(
newUsingAutoImportComponentsJson
!==
lastUsingAutoImportComponentsJson
)
{
lastUsingAutoImportComponentsJson
=
newUsingAutoImportComponentsJson
process
.
UNI_AUTO_COMPONENTS
=
parseUsingAutoImportComponents
(
usingAutoImportComponents
)
refreshAutoComponentMap
()
}
}
/**
/**
* UNI_AUTO_COMPONENTS 被更新,重新刷新 map
* UNI_AUTO_COMPONENTS 被更新,重新刷新 map
*/
*/
...
@@ -384,8 +397,8 @@ module.exports = {
...
@@ -384,8 +397,8 @@ module.exports = {
getPagesJson
,
getPagesJson
,
parsePagesJson
,
parsePagesJson
,
pagesJsonJsFileName
,
pagesJsonJsFileName
,
getAutoComponents
,
getAutoComponents
,
refreshAutoComponentMap
,
initAutoImportComponents
,
addPageUsingComponents
,
addPageUsingComponents
,
getUsingComponentsCode
,
getUsingComponentsCode
,
generateUsingComponentsCode
,
generateUsingComponentsCode
,
...
...
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
43e71a9f
...
@@ -308,6 +308,12 @@ if (
...
@@ -308,6 +308,12 @@ if (
}
}
}
}
const
{
initAutoImportComponents
}
=
require
(
'
@dcloudio/uni-cli-shared/lib/pages
'
)
initAutoImportComponents
(
pagesJsonObj
.
usingAutoImportComponents
)
runByHBuilderX
&&
console
.
log
(
`正在编译中...`
)
runByHBuilderX
&&
console
.
log
(
`正在编译中...`
)
module
.
exports
=
{
module
.
exports
=
{
...
...
packages/webpack-uni-pages-loader/lib/index-new.js
浏览文件 @
43e71a9f
...
@@ -18,8 +18,7 @@ const {
...
@@ -18,8 +18,7 @@ const {
const
{
const
{
pagesJsonJsFileName
,
pagesJsonJsFileName
,
refreshAutoComponentMap
,
initAutoImportComponents
parseUsingAutoImportComponents
}
=
require
(
'
@dcloudio/uni-cli-shared/lib/pages
'
)
}
=
require
(
'
@dcloudio/uni-cli-shared/lib/pages
'
)
const
parseStyle
=
require
(
'
./util
'
).
parseStyle
const
parseStyle
=
require
(
'
./util
'
).
parseStyle
...
@@ -33,17 +32,6 @@ function renameUsingComponents (jsonObj) {
...
@@ -33,17 +32,6 @@ function renameUsingComponents (jsonObj) {
return
jsonObj
return
jsonObj
}
}
let
lastUsingAutoImportComponentsJson
=
''
function
initAutoImportComponents
(
usingAutoImportComponents
=
{})
{
const
newUsingAutoImportComponentsJson
=
JSON
.
stringify
(
usingAutoImportComponents
)
if
(
newUsingAutoImportComponentsJson
!==
lastUsingAutoImportComponentsJson
)
{
lastUsingAutoImportComponentsJson
=
newUsingAutoImportComponentsJson
process
.
UNI_AUTO_COMPONENTS
=
parseUsingAutoImportComponents
(
usingAutoImportComponents
)
refreshAutoComponentMap
()
}
}
module
.
exports
=
function
(
content
)
{
module
.
exports
=
function
(
content
)
{
this
.
cacheable
&&
this
.
cacheable
()
this
.
cacheable
&&
this
.
cacheable
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录