Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
味无味_
uni-app
提交
d5ebc498
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,发现更多精彩内容 >>
提交
d5ebc498
编写于
1月 08, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of github.com:dcloudio/uni-app into dev
上级
19f264e8
d6017ca5
变更
23
展开全部
隐藏空白更改
内联
并排
Showing
23 changed file
with
201 addition
and
291 deletion
+201
-291
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+84
-44
packages/uni-cli-shared/lib/pages.js
packages/uni-cli-shared/lib/pages.js
+32
-9
packages/vue-cli-plugin-uni-optimize/index.js
packages/vue-cli-plugin-uni-optimize/index.js
+2
-3
packages/vue-cli-plugin-uni-optimize/packages/vue-loader/index.js
.../vue-cli-plugin-uni-optimize/packages/vue-loader/index.js
+0
-217
packages/vue-cli-plugin-uni/lib/app-plus/index.js
packages/vue-cli-plugin-uni/lib/app-plus/index.js
+11
-8
packages/vue-cli-plugin-uni/lib/env.js
packages/vue-cli-plugin-uni/lib/env.js
+4
-2
packages/vue-cli-plugin-uni/lib/h5/index.js
packages/vue-cli-plugin-uni/lib/h5/index.js
+3
-0
packages/vue-cli-plugin-uni/lib/mp.js
packages/vue-cli-plugin-uni/lib/mp.js
+3
-0
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.common.dev.js
...vue-cli-plugin-uni/packages/h5-vue/dist/vue.common.dev.js
+2
-0
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.common.prod.js
...ue-cli-plugin-uni/packages/h5-vue/dist/vue.common.prod.js
+1
-1
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.esm.browser.js
...ue-cli-plugin-uni/packages/h5-vue/dist/vue.esm.browser.js
+2
-0
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.esm.browser.min.js
...li-plugin-uni/packages/h5-vue/dist/vue.esm.browser.min.js
+1
-1
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.esm.js
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.esm.js
+2
-0
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.js
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.js
+2
-0
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.min.js
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.min.js
+1
-1
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.common.dev.js
...plugin-uni/packages/h5-vue/dist/vue.runtime.common.dev.js
+2
-0
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.common.prod.js
...lugin-uni/packages/h5-vue/dist/vue.runtime.common.prod.js
+1
-1
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.esm.js
...ue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.esm.js
+2
-0
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.js
...es/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.js
+2
-0
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.min.js
...ue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.min.js
+1
-1
packages/vue-cli-plugin-uni/packages/vue-loader/lib/index.js
packages/vue-cli-plugin-uni/packages/vue-loader/lib/index.js
+18
-1
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/plugin/index.js
...lugin-uni/packages/webpack-uni-app-loader/plugin/index.js
+23
-0
src/platforms/h5/components/system-routes/open-location/index.vue
...forms/h5/components/system-routes/open-location/index.vue
+2
-2
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
d5ebc498
...
...
@@ -2721,8 +2721,11 @@ var serviceContext = (function () {
return
false
}
return
page
.
$page
.
meta
.
isTabBar
}
if
(
!
/^
\/
/
.
test
(
path
))
{
path
=
'
/
'
+
path
;
}
const
route
=
__uniRoutes
.
find
(
route
=>
route
.
path
.
replace
(
/^
\/
/
,
''
)
===
path
.
replace
(
/^
\/
/
,
''
)
);
const
route
=
__uniRoutes
.
find
(
route
=>
route
.
path
===
path
);
return
route
&&
route
.
meta
.
isTabBar
}
catch
(
e
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
...
...
@@ -2886,7 +2889,25 @@ var serviceContext = (function () {
const
outOfChina
=
function
(
lng
,
lat
)
{
return
(
lng
<
72.004
||
lng
>
137.8347
)
||
((
lat
<
0.8293
||
lat
>
55.8271
)
||
false
)
};
};
function
getStatusbarHeight
()
{
// 横屏时 iOS 获取的状态栏高度错误,进行纠正
return
plus
.
navigator
.
isImmersedStatusbar
()
?
Math
.
round
(
plus
.
os
.
name
===
'
iOS
'
?
plus
.
navigator
.
getSafeAreaInsets
().
top
:
plus
.
navigator
.
getStatusbarHeight
())
:
0
}
function
getScreenInfo
()
{
const
orientation
=
plus
.
navigator
.
getOrientation
();
const
landscape
=
Math
.
abs
(
orientation
)
===
90
;
// 安卓 plus 接口获取的屏幕大小值不为整数
const
width
=
plus
.
screen
.
resolutionWidth
;
const
height
=
plus
.
screen
.
resolutionHeight
;
// 根据方向纠正宽高
return
{
screenWidth
:
Math
[
landscape
?
'
max
'
:
'
min
'
](
width
,
height
),
screenHeight
:
Math
[
landscape
?
'
min
'
:
'
max
'
](
width
,
height
)
}
}
let
audios
=
{};
...
...
@@ -4941,48 +4962,55 @@ var serviceContext = (function () {
function
getSystemInfo
()
{
const
platform
=
plus
.
os
.
name
.
toLowerCase
();
const
ios
=
platform
===
'
ios
'
;
// 安卓 plus 接口获取的屏幕大小值不为整数,iOS js 获取的屏幕大小横屏时颠倒
const
screenWidth
=
plus
.
screen
.
resolutionWidth
;
const
screenHeight
=
plus
.
screen
.
resolutionHeight
;
// 横屏时 iOS 获取的状态栏高度错误,进行纠正
var
landscape
=
Math
.
abs
(
plus
.
navigator
.
getOrientation
())
===
90
;
var
statusBarHeight
=
Math
.
round
(
plus
.
navigator
.
getStatusbarHeight
());
if
(
ios
&&
landscape
)
{
statusBarHeight
=
Math
.
min
(
20
,
statusBarHeight
);
}
var
safeAreaInsets
;
function
getSafeAreaInsets
()
{
return
{
left
:
0
,
right
:
0
,
top
:
titleNView
?
0
:
statusBarHeight
,
bottom
:
0
}
}
// 判断是否存在 titleNView
var
titleNView
;
var
webview
=
getLastWebview
();
const
{
screenWidth
,
screenHeight
}
=
getScreenInfo
();
const
statusBarHeight
=
getStatusbarHeight
();
let
safeAreaInsets
;
const
titleNView
=
{
height
:
0
,
cover
:
false
};
const
webview
=
getLastWebview
();
if
(
webview
)
{
let
style
=
webview
.
getStyle
();
if
(
style
)
{
titleNView
=
style
&&
style
.
titleNView
;
titleNView
=
titleNView
&&
titleNView
.
type
===
'
default
'
;
style
=
style
&&
style
.
titleNView
;
if
(
style
&&
style
.
type
&&
style
.
type
!==
'
none
'
)
{
titleNView
.
height
=
style
.
type
===
'
transparent
'
?
0
:
(
statusBarHeight
+
TITLEBAR_HEIGHT
);
titleNView
.
cover
=
style
.
type
===
'
transparent
'
||
style
.
type
===
'
float
'
;
}
safeAreaInsets
=
ios
?
webview
.
getSafeAreaInsets
()
:
getSafeAreaInsets
();
safeAreaInsets
=
webview
.
getSafeAreaInsets
();
}
else
{
safeAreaInsets
=
ios
?
plus
.
navigator
.
getSafeAreaInsets
()
:
getSafeAreaInsets
();
safeAreaInsets
=
plus
.
navigator
.
getSafeAreaInsets
();
}
var
windowBottom
=
isTabBarPage
()
&&
tabBar$1
.
visible
&&
tabBar$1
.
cover
?
tabBar$1
.
height
:
0
;
var
windowHeight
=
Math
.
min
(
screenHeight
-
(
titleNView
?
(
statusBarHeight
+
TITLEBAR_HEIGHT
)
:
0
)
-
windowBottom
,
screenHeight
);
var
windowWidth
=
screenWidth
;
var
safeArea
=
{
const
tabBarView
=
{
height
:
0
,
cover
:
false
};
if
(
isTabBarPage
())
{
tabBarView
.
height
=
tabBar$1
.
visible
?
tabBar$1
.
height
:
0
;
tabBarView
.
cover
=
tabBar$1
.
cover
;
}
const
windowTop
=
titleNView
.
cover
?
titleNView
.
height
:
0
;
const
windowBottom
=
tabBarView
.
cover
?
tabBarView
.
height
:
0
;
const
windowHeight
=
screenHeight
-
titleNView
.
height
-
tabBarView
.
height
;
const
windowHeightReal
=
screenHeight
-
(
titleNView
.
cover
?
0
:
titleNView
.
height
)
-
(
tabBarView
.
cover
?
0
:
tabBarView
.
height
);
const
windowWidth
=
screenWidth
;
safeAreaInsets
=
ios
?
safeAreaInsets
:
{
left
:
0
,
right
:
0
,
top
:
titleNView
.
height
&&
!
titleNView
.
cover
?
0
:
statusBarHeight
,
bottom
:
0
};
const
safeArea
=
{
left
:
safeAreaInsets
.
left
,
right
:
windowWidth
-
safeAreaInsets
.
right
,
top
:
safeAreaInsets
.
top
,
bottom
:
windowHeight
-
safeAreaInsets
.
bottom
,
bottom
:
windowHeight
Real
-
safeAreaInsets
.
bottom
,
width
:
windowWidth
-
safeAreaInsets
.
left
-
safeAreaInsets
.
right
,
height
:
windowHeight
-
safeAreaInsets
.
top
-
safeAreaInsets
.
bottom
height
:
windowHeight
Real
-
safeAreaInsets
.
top
-
safeAreaInsets
.
bottom
};
return
{
...
...
@@ -5001,9 +5029,15 @@ var serviceContext = (function () {
fontSizeSetting
:
''
,
platform
,
SDKVersion
:
''
,
windowTop
:
0
,
windowTop
,
windowBottom
,
safeArea
safeArea
,
safeAreaInsets
:
{
top
:
safeAreaInsets
.
top
,
right
:
safeAreaInsets
.
right
,
bottom
:
safeAreaInsets
.
bottom
,
left
:
safeAreaInsets
.
left
}
}
}
...
...
@@ -7276,7 +7310,7 @@ var serviceContext = (function () {
function
parsePullToRefresh
(
routeOptions
)
{
const
windowOptions
=
routeOptions
.
window
;
if
(
windowOptions
.
enablePullDownRefresh
)
{
if
(
windowOptions
.
enablePullDownRefresh
||
(
windowOptions
.
pullToRefresh
&&
windowOptions
.
pullToRefresh
.
support
)
)
{
const
pullToRefreshStyles
=
Object
.
create
(
null
);
// 初始化默认值
if
(
plus
.
os
.
name
===
'
Android
'
)
{
...
...
@@ -7498,7 +7532,7 @@ var serviceContext = (function () {
style
.
dock
=
'
top
'
;
style
.
top
=
0
;
style
.
width
=
'
100%
'
;
style
.
height
=
TITLEBAR_HEIGHT
+
plus
.
navigator
.
getStatusbarHeight
();
style
.
height
=
TITLEBAR_HEIGHT
+
getStatusbarHeight
();
delete
style
.
left
;
delete
style
.
right
;
delete
style
.
bottom
;
...
...
@@ -7768,7 +7802,10 @@ var serviceContext = (function () {
let
todoNavigator
=
false
;
function
navigate
(
path
,
callback
,
isAppLaunch
)
{
{
{
if
(
isAppLaunch
&&
__uniConfig
.
splashscreen
&&
__uniConfig
.
splashscreen
.
autoclose
&&
(
!
__uniConfig
.
splashscreen
.
alwaysShowBeforeRender
))
{
plus
.
navigator
.
closeSplashscreen
();
}
if
(
!
isAppLaunch
&&
todoNavigator
)
{
return
console
.
error
(
`已存在待跳转页面
${
todoNavigator
.
path
}
,请不要连续多次跳转页面
${
path
}
`
)
}
...
...
@@ -12073,8 +12110,9 @@ var serviceContext = (function () {
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
`[uni-app] registerApp`
);
}
appCtx
=
appVm
;
appCtx
=
appVm
;
appCtx
.
$vm
=
appVm
;
Object
.
assign
(
appCtx
,
defaultApp
);
// 拷贝默认实现
...
...
@@ -12278,7 +12316,7 @@ var serviceContext = (function () {
const
isAndroid
=
plus
.
os
.
name
.
toLowerCase
()
===
'
android
'
;
const
FOCUS_TIMEOUT
=
isAndroid
?
300
:
700
;
const
HIDE_TIMEOUT
=
3
00
;
const
HIDE_TIMEOUT
=
8
00
;
let
keyboardHeight
=
0
;
let
onKeyboardShow
;
let
focusTimer
;
...
...
@@ -12915,13 +12953,15 @@ var serviceContext = (function () {
const
onPageScroll
=
hasLifecycleHook
(
vm
.
$options
,
'
onPageScroll
'
)
?
1
:
0
;
const
onPageReachBottom
=
hasLifecycleHook
(
vm
.
$options
,
'
onReachBottom
'
)
?
1
:
0
;
const
statusbarHeight
=
getStatusbarHeight
();
return
{
disableScroll
,
onPageScroll
,
onPageReachBottom
,
onReachBottomDistance
,
windowTop
:
0
,
// TODO
statusbarHeight
,
windowTop
:
windowOptions
.
titleNView
&&
windowOptions
.
titleNView
.
type
===
'
float
'
?
(
statusbarHeight
+
TITLEBAR_HEIGHT
)
:
0
,
windowBottom
:
(
tabBar$1
.
indexOf
(
route
)
>=
0
&&
tabBar$1
.
cover
)
?
tabBar$1
.
height
:
0
}
}
...
...
packages/uni-cli-shared/lib/pages.js
浏览文件 @
d5ebc498
...
...
@@ -330,17 +330,37 @@ const autoComponentMap = {}
let
lastUsingAutoImportComponentsJson
=
''
process
.
UNI_AUTO_COMPONENTS
=
[]
let
uniAutoImportComponents
=
[]
let
uniAutoImportScanComponents
=
[]
function
initAutoImportScanComponents
()
{
const
componentsPath
=
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
components
'
)
const
components
=
{}
try
{
fs
.
readdirSync
(
componentsPath
).
forEach
(
name
=>
{
if
(
fs
.
existsSync
(
path
.
resolve
(
componentsPath
,
name
,
name
+
'
.vue
'
)))
{
components
[
`^
${
name
}
$`
]
=
`@/components/
${
name
}
/
${
name
}
.vue`
}
else
if
(
fs
.
existsSync
(
path
.
resolve
(
componentsPath
,
name
,
name
+
'
.nvue
'
)))
{
components
[
`^
${
name
}
$`
]
=
`@/components/
${
name
}
/
${
name
}
.nvue`
}
})
}
catch
(
e
)
{}
uniAutoImportScanComponents
=
parseUsingAutoImportComponents
(
components
)
refreshAutoComponentMap
()
}
function
initAutoImportComponents
(
usingAutoImportComponents
=
{})
{
// 目前仅 mp-weixin 内置支持 page-meta 等组件
if
(
process
.
env
.
UNI_PLATFORM
!==
'
mp-weixin
'
)
{
if
(
!
usingAutoImportComponents
[
'
page-meta
'
])
{
usingAutoImportComponents
[
'
page-meta
'
]
=
if
(
!
usingAutoImportComponents
[
'
^page-meta$
'
])
{
usingAutoImportComponents
[
'
^page-meta$
'
]
=
'
@dcloudio/uni-cli-shared/components/page-meta.vue
'
}
if
(
!
usingAutoImportComponents
[
'
navigation-bar
'
])
{
usingAutoImportComponents
[
'
navigation-bar
'
]
=
if
(
!
usingAutoImportComponents
[
'
^navigation-bar$
'
])
{
usingAutoImportComponents
[
'
^navigation-bar$
'
]
=
'
@dcloudio/uni-cli-shared/components/navigation-bar.vue
'
}
}
...
...
@@ -348,7 +368,7 @@ function initAutoImportComponents (usingAutoImportComponents = {}) {
const
newUsingAutoImportComponentsJson
=
JSON
.
stringify
(
usingAutoImportComponents
)
if
(
newUsingAutoImportComponentsJson
!==
lastUsingAutoImportComponentsJson
)
{
lastUsingAutoImportComponentsJson
=
newUsingAutoImportComponentsJson
process
.
UNI_AUTO_COMPONENTS
=
parseUsingAutoImportComponents
(
usingAutoImportComponents
)
uniAutoImportComponents
=
parseUsingAutoImportComponents
(
usingAutoImportComponents
)
refreshAutoComponentMap
()
}
}
...
...
@@ -363,8 +383,10 @@ function refreshAutoComponentMap () {
}
function
addAutoComponent
(
name
)
{
const
options
=
process
.
UNI_AUTO_COMPONENTS
const
opt
=
options
.
find
(
opt
=>
opt
.
pattern
.
test
(
name
))
let
opt
=
uniAutoImportComponents
.
find
(
opt
=>
opt
.
pattern
.
test
(
name
))
if
(
!
opt
)
{
opt
=
uniAutoImportScanComponents
.
find
(
opt
=>
opt
.
pattern
.
test
(
name
))
}
if
(
!
opt
)
{
// 不匹配
return
(
autoComponentMap
[
name
]
=
true
)
// cache
}
...
...
@@ -410,7 +432,8 @@ module.exports = {
parsePagesJson
,
pagesJsonJsFileName
,
getAutoComponents
,
initAutoImportComponents
,
initAutoImportComponents
,
initAutoImportScanComponents
,
addPageUsingComponents
,
getUsingComponentsCode
,
generateUsingComponentsCode
,
...
...
packages/vue-cli-plugin-uni-optimize/index.js
浏览文件 @
d5ebc498
...
...
@@ -80,11 +80,10 @@ module.exports = (api, options) => {
webpackConfig
.
module
.
rule
(
'
vue
'
)
.
use
(
'
vue-loader
'
)
.
loader
(
resolve
(
'
packages/vue-loader
'
))
.
tap
(
options
=>
Object
.
assign
(
options
,
{
isH5TreeShaking
:
true
,
cacheDirectory
:
false
,
cacheIdentifier
:
false
,
compilerOptions
:
require
(
'
@dcloudio/vue-cli-plugin-uni/lib/h5/compiler-options
'
)
cacheIdentifier
:
false
}))
.
end
()
.
uses
...
...
packages/vue-cli-plugin-uni-optimize/packages/vue-loader/index.js
已删除
100644 → 0
浏览文件 @
19f264e8
const
path
=
require
(
'
path
'
)
const
hash
=
require
(
'
hash-sum
'
)
const
qs
=
require
(
'
querystring
'
)
const
plugin
=
require
(
'
vue-loader/lib/plugin
'
)
const
selectBlock
=
require
(
'
vue-loader/lib/select
'
)
const
loaderUtils
=
require
(
'
loader-utils
'
)
const
{
attrsToQuery
}
=
require
(
'
vue-loader/lib/codegen/utils
'
)
const
{
parse
}
=
require
(
'
@vue/component-compiler-utils
'
)
const
genStylesCode
=
require
(
'
vue-loader/lib/codegen/styleInjection
'
)
const
{
genHotReloadCode
}
=
require
(
'
vue-loader/lib/codegen/hotReload
'
)
const
genCustomBlocksCode
=
require
(
'
vue-loader/lib/codegen/customBlocks
'
)
const
componentNormalizerPath
=
require
.
resolve
(
'
vue-loader/lib/runtime/componentNormalizer
'
)
const
{
NS
}
=
require
(
'
vue-loader/lib/plugin
'
)
const
{
src
}
=
require
(
'
@dcloudio/uni-h5/path
'
)
let
errorEmitted
=
false
const
isWin
=
/^win/
.
test
(
process
.
platform
)
const
normalizePath
=
path
=>
(
isWin
?
path
.
replace
(
/
\\
/g
,
'
/
'
)
:
path
)
function
loadTemplateCompiler
(
loaderContext
)
{
try
{
return
require
(
'
vue-template-compiler
'
)
}
catch
(
e
)
{
if
(
/version mismatch/
.
test
(
e
.
toString
()))
{
loaderContext
.
emitError
(
e
)
}
else
{
loaderContext
.
emitError
(
new
Error
(
`[vue-loader] vue-template-compiler must be installed as a peer dependency, `
+
`or a compatible compiler implementation must be passed via options.`
))
}
}
}
let
modules
module
.
exports
=
function
(
source
)
{
const
loaderContext
=
this
if
(
!
errorEmitted
&&
!
loaderContext
[
'
thread-loader
'
]
&&
!
loaderContext
[
NS
])
{
loaderContext
.
emitError
(
new
Error
(
`vue-loader was used without the corresponding plugin. `
+
`Make sure to include VueLoaderPlugin in your webpack config.`
))
errorEmitted
=
true
}
const
stringifyRequest
=
r
=>
loaderUtils
.
stringifyRequest
(
loaderContext
,
r
)
const
{
target
,
request
,
minimize
,
sourceMap
,
rootContext
,
resourcePath
,
resourceQuery
}
=
loaderContext
const
rawQuery
=
resourceQuery
.
slice
(
1
)
const
inheritQuery
=
`&
${
rawQuery
}
`
const
incomingQuery
=
qs
.
parse
(
rawQuery
)
const
options
=
loaderUtils
.
getOptions
(
loaderContext
)
||
{}
const
isServer
=
target
===
'
node
'
const
isShadow
=
!!
options
.
shadowMode
const
isProduction
=
options
.
productionMode
||
minimize
||
process
.
env
.
NODE_ENV
===
'
production
'
const
filename
=
path
.
basename
(
resourcePath
)
const
context
=
rootContext
||
process
.
cwd
()
const
sourceRoot
=
path
.
dirname
(
path
.
relative
(
context
,
resourcePath
))
const
descriptor
=
parse
({
source
,
compiler
:
options
.
compiler
||
loadTemplateCompiler
(
loaderContext
),
filename
,
sourceRoot
,
needMap
:
sourceMap
})
// fixed by xxxxxx
if
(
!
modules
&&
options
.
compilerOptions
&&
options
.
compilerOptions
.
modules
){
modules
=
options
.
compilerOptions
.
modules
}
const
sourcePath
=
normalizePath
(
src
)
if
(
normalizePath
(
this
.
resourcePath
).
indexOf
(
sourcePath
)
===
0
)
{
descriptor
.
styles
.
length
=
0
options
.
compilerOptions
&&
(
delete
options
.
compilerOptions
.
modules
)
}
else
if
(
options
.
compilerOptions
){
options
.
compilerOptions
.
modules
=
modules
}
// if the query has a type field, this is a language block request
// e.g. foo.vue?type=template&id=xxxxx
// and we will return early
if
(
incomingQuery
.
type
)
{
return
selectBlock
(
descriptor
,
loaderContext
,
incomingQuery
,
!!
options
.
appendExtension
)
}
// module id for scoped CSS & hot-reload
const
rawShortFilePath
=
path
.
relative
(
context
,
resourcePath
)
.
replace
(
/^
(\.\.[\/\\])
+/
,
''
)
const
shortFilePath
=
rawShortFilePath
.
replace
(
/
\\
/g
,
'
/
'
)
+
resourceQuery
const
id
=
hash
(
isProduction
?
(
shortFilePath
+
'
\n
'
+
source
)
:
shortFilePath
)
// feature information
const
hasScoped
=
descriptor
.
styles
.
some
(
s
=>
s
.
scoped
)
const
hasFunctional
=
descriptor
.
template
&&
descriptor
.
template
.
attrs
.
functional
const
needsHotReload
=
(
!
isServer
&&
!
isProduction
&&
(
descriptor
.
script
||
descriptor
.
template
)
&&
options
.
hotReload
!==
false
)
// template
let
templateImport
=
`var render, staticRenderFns`
let
templateRequest
if
(
descriptor
.
template
)
{
const
src
=
descriptor
.
template
.
src
||
resourcePath
const
idQuery
=
`&id=
${
id
}
`
const
scopedQuery
=
hasScoped
?
`&scoped=true`
:
``
const
attrsQuery
=
attrsToQuery
(
descriptor
.
template
.
attrs
)
const
query
=
`?vue&type=template
${
idQuery
}${
scopedQuery
}${
attrsQuery
}${
inheritQuery
}
`
const
request
=
templateRequest
=
stringifyRequest
(
src
+
query
)
templateImport
=
`import { render, staticRenderFns } from
${
request
}
`
}
// script
let
scriptImport
=
`var script = {}`
if
(
descriptor
.
script
)
{
const
src
=
descriptor
.
script
.
src
||
resourcePath
const
attrsQuery
=
attrsToQuery
(
descriptor
.
script
.
attrs
,
'
js
'
)
const
query
=
`?vue&type=script
${
attrsQuery
}${
inheritQuery
}
`
const
request
=
stringifyRequest
(
src
+
query
)
scriptImport
=
(
`import script from
${
request
}
\n`
+
`export * from
${
request
}
`
// support named exports
)
}
// styles
let
stylesCode
=
``
if
(
descriptor
.
styles
.
length
)
{
stylesCode
=
genStylesCode
(
loaderContext
,
descriptor
.
styles
,
id
,
resourcePath
,
stringifyRequest
,
needsHotReload
,
isServer
||
isShadow
// needs explicit injection?
)
}
let
code
=
`
${
templateImport
}
${
scriptImport
}
${
stylesCode
}
/* normalize component */
import normalizer from
${
stringifyRequest
(
`!
${
componentNormalizerPath
}
`
)}
var component = normalizer(
script,
render,
staticRenderFns,
${
hasFunctional
?
`true`
:
`false`
}
,
${
/
injectStyles
/
.
test
(
stylesCode
)
?
`injectStyles`
:
`null`
}
,
${
hasScoped
?
JSON
.
stringify
(
id
)
:
`null`
}
,
${
isServer
?
JSON
.
stringify
(
hash
(
request
))
:
`null`
}
${
isShadow
?
`,true`
:
``
}
)
`
.
trim
()
+
`\n`
if
(
descriptor
.
customBlocks
&&
descriptor
.
customBlocks
.
length
)
{
code
+=
genCustomBlocksCode
(
descriptor
.
customBlocks
,
resourcePath
,
resourceQuery
,
stringifyRequest
)
}
if
(
needsHotReload
)
{
code
+=
`\n`
+
genHotReloadCode
(
id
,
hasFunctional
,
templateRequest
)
}
// Expose filename. This is used by the devtools and Vue runtime warnings.
if
(
!
isProduction
)
{
// Expose the file's full path in development, so that it can be opened
// from the devtools.
code
+=
`\ncomponent.options.__file =
${
JSON
.
stringify
(
rawShortFilePath
.
replace
(
/
\\
/g
,
'
/
'
))}
`
}
else
if
(
options
.
exposeFilename
)
{
// Libraies can opt-in to expose their components' filenames in production builds.
// For security reasons, only expose the file's basename in production.
code
+=
`\ncomponent.options.__file =
${
JSON
.
stringify
(
filename
)}
`
}
code
+=
`\nexport default component.exports`
// console.log(code)
return
code
}
module
.
exports
.
VueLoaderPlugin
=
plugin
packages/vue-cli-plugin-uni/lib/app-plus/index.js
浏览文件 @
d5ebc498
...
...
@@ -11,6 +11,8 @@ const {
getGlobalUsingComponentsCode
}
=
require
(
'
@dcloudio/uni-cli-shared/lib/pages
'
)
const
WebpackUniAppPlugin
=
require
(
'
../../packages/webpack-uni-app-loader/plugin/index
'
)
const
{
isUnaryTag
,
getPartialIdentifier
...
...
@@ -36,7 +38,7 @@ function getProvides (isAppService) {
'
getRegExp
'
:
[
wxsPath
,
'
getRegExp
'
]
}
}
return
{
// app-view
return
{
// app-view
'
__f__
'
:
[
path
.
resolve
(
__dirname
,
'
../format-log.js
'
),
'
default
'
],
'
getDate
'
:
[
wxsPath
,
'
getDate
'
],
'
getRegExp
'
:
[
wxsPath
,
'
getRegExp
'
]
...
...
@@ -172,6 +174,7 @@ const v3 = {
]
},
plugins
:
[
new
WebpackUniAppPlugin
(),
new
webpack
.
ProvidePlugin
(
getProvides
(
isAppService
))
]
}
...
...
@@ -246,13 +249,13 @@ const v3 = {
compilerOptions
},
cacheConfig
))
.
end
()
// .use('uniapp-custom-block-loader')
// .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader'))
// .options({
// isAppService,
// isAppView,
// compiler: getPlatformCompiler()
// })
// .use('uniapp-custom-block-loader')
// .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader'))
// .options({
// isAppService,
// isAppView,
// compiler: getPlatformCompiler()
// })
// 是否启用 cache
if
(
process
.
env
.
UNI_USING_CACHE
)
{
...
...
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
d5ebc498
...
...
@@ -312,9 +312,11 @@ if (
}
const
{
initAutoImportComponents
initAutoImportComponents
,
initAutoImportScanComponents
}
=
require
(
'
@dcloudio/uni-cli-shared/lib/pages
'
)
initAutoImportScanComponents
()
initAutoImportComponents
(
pagesJsonObj
.
easycom
)
runByHBuilderX
&&
console
.
log
(
`正在编译中...`
)
...
...
packages/vue-cli-plugin-uni/lib/h5/index.js
浏览文件 @
d5ebc498
...
...
@@ -15,6 +15,8 @@ const modifyVueLoader = require('../vue-loader')
const
WebpackHtmlAppendPlugin
=
require
(
'
../../packages/webpack-html-append-plugin
'
)
const
WebpackUniAppPlugin
=
require
(
'
../../packages/webpack-uni-app-loader/plugin/index
'
)
function
resolve
(
dir
)
{
return
path
.
resolve
(
__dirname
,
'
../../
'
,
dir
)
}
...
...
@@ -41,6 +43,7 @@ function getProvides () {
}
const
plugins
=
[
new
WebpackUniAppPlugin
(),
new
webpack
.
ProvidePlugin
(
getProvides
())
]
...
...
packages/vue-cli-plugin-uni/lib/mp.js
浏览文件 @
d5ebc498
...
...
@@ -8,6 +8,8 @@ const {
getPlatformCssnano
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
WebpackUniAppPlugin
=
require
(
'
../packages/webpack-uni-app-loader/plugin/index
'
)
const
modifyVueLoader
=
require
(
'
./vue-loader
'
)
const
{
...
...
@@ -157,6 +159,7 @@ module.exports = {
}]
},
plugins
:
[
new
WebpackUniAppPlugin
(),
createUniMPPlugin
(),
new
webpack
.
ProvidePlugin
(
getProvides
())
]
...
...
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.common.dev.js
浏览文件 @
d5ebc498
...
...
@@ -6785,6 +6785,8 @@ function updateWxsProps(oldVnode, vnode) {
context
.
$getComponentDescriptor
(
context
,
true
),
vnode
.
elm
.
__vue__
.
$getComponentDescriptor
(
vnode
.
elm
.
__vue__
,
false
)
);
},
{
deep
:
true
});
});
...
...
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.common.prod.js
浏览文件 @
d5ebc498
此差异已折叠。
点击以展开。
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.esm.browser.js
浏览文件 @
d5ebc498
...
...
@@ -6815,6 +6815,8 @@ function updateWxsProps(oldVnode, vnode) {
context
.
$getComponentDescriptor
(
context
,
true
),
vnode
.
elm
.
__vue__
.
$getComponentDescriptor
(
vnode
.
elm
.
__vue__
,
false
)
);
},
{
deep
:
true
});
});
...
...
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.esm.browser.min.js
浏览文件 @
d5ebc498
此差异已折叠。
点击以展开。
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.esm.js
浏览文件 @
d5ebc498
...
...
@@ -6807,6 +6807,8 @@ function updateWxsProps(oldVnode, vnode) {
context
.
$getComponentDescriptor
(
context
,
true
),
vnode
.
elm
.
__vue__
.
$getComponentDescriptor
(
vnode
.
elm
.
__vue__
,
false
)
);
},
{
deep
:
true
});
});
...
...
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.js
浏览文件 @
d5ebc498
...
...
@@ -6789,6 +6789,8 @@
context
.
$getComponentDescriptor
(
context
,
true
),
vnode
.
elm
.
__vue__
.
$getComponentDescriptor
(
vnode
.
elm
.
__vue__
,
false
)
);
},
{
deep
:
true
});
});
...
...
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.min.js
浏览文件 @
d5ebc498
此差异已折叠。
点击以展开。
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.common.dev.js
浏览文件 @
d5ebc498
...
...
@@ -6774,6 +6774,8 @@ function updateWxsProps(oldVnode, vnode) {
context
.
$getComponentDescriptor
(
context
,
true
),
vnode
.
elm
.
__vue__
.
$getComponentDescriptor
(
vnode
.
elm
.
__vue__
,
false
)
);
},
{
deep
:
true
});
});
...
...
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.common.prod.js
浏览文件 @
d5ebc498
此差异已折叠。
点击以展开。
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.esm.js
浏览文件 @
d5ebc498
...
...
@@ -6796,6 +6796,8 @@ function updateWxsProps(oldVnode, vnode) {
context
.
$getComponentDescriptor
(
context
,
true
),
vnode
.
elm
.
__vue__
.
$getComponentDescriptor
(
vnode
.
elm
.
__vue__
,
false
)
);
},
{
deep
:
true
});
});
...
...
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.js
浏览文件 @
d5ebc498
...
...
@@ -6778,6 +6778,8 @@
context
.
$getComponentDescriptor
(
context
,
true
),
vnode
.
elm
.
__vue__
.
$getComponentDescriptor
(
vnode
.
elm
.
__vue__
,
false
)
);
},
{
deep
:
true
});
});
...
...
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.min.js
浏览文件 @
d5ebc498
此差异已折叠。
点击以展开。
packages/vue-cli-plugin-uni/packages/vue-loader/lib/index.js
浏览文件 @
d5ebc498
...
...
@@ -13,7 +13,7 @@ const componentNormalizerPath = require.resolve('./runtime/componentNormalizer')
const
{
NS
}
=
require
(
'
./plugin
'
)
let
errorEmitted
=
false
let
modules
// h5 平台摇树优化时,需要保留编译器原始modules(因为框架内代码不需要modules,开发者代码需要)
function
loadTemplateCompiler
(
loaderContext
)
{
try
{
return
require
(
'
vue-template-compiler
'
)
...
...
@@ -75,6 +75,23 @@ module.exports = function (source) {
isAppNVue
:
options
.
isAppNVue
})
if
(
options
.
isH5TreeShaking
)
{
// 摇树优化逻辑(框架组件移除样式,禁用 modules)
const
isWin
=
/^win/
.
test
(
process
.
platform
)
const
normalizePath
=
path
=>
(
isWin
?
path
.
replace
(
/
\\
/g
,
'
/
'
)
:
path
)
// fixed by xxxxxx
if
(
!
modules
&&
options
.
compilerOptions
&&
options
.
compilerOptions
.
modules
){
modules
=
options
.
compilerOptions
.
modules
}
const
sourcePath
=
normalizePath
(
require
(
'
@dcloudio/uni-h5/path
'
).
src
)
if
(
normalizePath
(
this
.
resourcePath
).
indexOf
(
sourcePath
)
===
0
)
{
descriptor
.
styles
.
length
=
0
options
.
compilerOptions
&&
(
delete
options
.
compilerOptions
.
modules
)
}
else
if
(
options
.
compilerOptions
){
options
.
compilerOptions
.
modules
=
modules
}
}
// if the query has a type field, this is a language block request
// e.g. foo.vue?type=template&id=xxxxx
// and we will return early
...
...
packages/vue-cli-plugin-uni/packages/webpack-uni-app-loader/plugin/index.js
0 → 100644
浏览文件 @
d5ebc498
const
path
=
require
(
'
path
'
)
const
{
normalizePath
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
{
initAutoImportScanComponents
}
=
require
(
'
@dcloudio/uni-cli-shared/lib/pages
'
)
class
WebpackUniAppPlugin
{
apply
(
compiler
)
{
compiler
.
hooks
.
invalid
.
tap
(
'
webpack-uni-app-invalid
'
,
(
fileName
,
changeTime
)
=>
{
if
(
fileName
&&
typeof
fileName
===
'
string
'
)
{
if
(
fileName
.
indexOf
(
'
.vue
'
)
!==
-
1
||
fileName
.
indexOf
(
'
.nvue
'
)
!==
-
1
)
{
initAutoImportScanComponents
()
}
}
})
}
}
module
.
exports
=
WebpackUniAppPlugin
src/platforms/h5/components/system-routes/open-location/index.vue
浏览文件 @
d5ebc498
...
...
@@ -69,8 +69,8 @@ export default {
}
},
_nav
()
{
var
url
=
`https://apis.map.qq.com/uri/v1/routeplan?type=drive&to=
${
encodeURIComponent
(
this
.
name
||
'
目的地
'
)}
&tocoord=
${
this
.
latitude
}
,
${
this
.
longitude
}
&referer=
${
referer
}
`
var
url
=
`https://map.qq.com/nav/drive#routes/page?transport=2&epointy=
${
this
.
latitude
}
&epointx=
${
this
.
longitude
}
&eword=
${
encodeURIComponent
(
this
.
name
||
'
目的地
'
)
}
&referer=
${
referer
}
`
this
.
$refs
.
map
.
src
=
url
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录