Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wk1234123
uni-app
提交
eb2f83a1
uni-app
项目概览
wk1234123
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eb2f83a1
编写于
10月 25, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(v3): getRealPath
上级
560ec7ad
变更
11
展开全部
显示空白变更内容
内联
并排
Showing
11 changed file
with
23424 addition
and
56 deletion
+23424
-56
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+18
-1
packages/uni-app-plus/dist/view.css
packages/uni-app-plus/dist/view.css
+1358
-1
packages/uni-app-plus/dist/view.umd.js
packages/uni-app-plus/dist/view.umd.js
+21995
-3
packages/uni-cli-shared/template/__uniappview.html
packages/uni-cli-shared/template/__uniappview.html
+4
-11
packages/uni-template-compiler/__tests__/compiler-app-plus-extra.service.spec.js
...ompiler/__tests__/compiler-app-plus-extra.service.spec.js
+2
-2
packages/uni-template-compiler/__tests__/demo.js
packages/uni-template-compiler/__tests__/demo.js
+1
-1
packages/uni-template-compiler/lib/app/util.js
packages/uni-template-compiler/lib/app/util.js
+9
-7
src/platforms/app-plus/helpers/get-real-path.js
src/platforms/app-plus/helpers/get-real-path.js
+18
-1
src/platforms/app-plus/view/framework/plugins/event.js
src/platforms/app-plus/view/framework/plugins/event.js
+3
-11
src/platforms/app-plus/view/framework/plugins/vdom-sync.js
src/platforms/app-plus/view/framework/plugins/vdom-sync.js
+11
-18
src/platforms/app-plus/view/index.css
src/platforms/app-plus/view/index.css
+5
-0
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
eb2f83a1
...
...
@@ -1054,8 +1054,20 @@ var serviceContext = (function () {
const
SCHEME_RE
=
/^
([
a-z-
]
+:
)?\/\/
/i
;
const
DATA_RE
=
/^data:.*,.*/
;
// 处理 Android 平台解压与非解压模式下获取的路径不一致的情况
function
handleLocalPath
(
filePath
)
{
return
plus
.
io
.
convertLocalFileSystemURL
(
filePath
)
.
replace
(
/^
\/?
apps
\/
/
,
'
/android_asset/apps/
'
)
.
replace
(
/
\/
$/
,
''
)
}
let
wwwPath
;
function
addBase
(
filePath
)
{
return
filePath
if
(
!
wwwPath
)
{
// 需要时,初始化一次,外部直接初始化,需要等 plusready
wwwPath
=
'
file://
'
+
handleLocalPath
(
'
_www
'
)
+
'
/
'
;
}
return
wwwPath
+
filePath
}
function
getRealPath
(
filePath
)
{
...
...
@@ -1071,6 +1083,11 @@ var serviceContext = (function () {
return
filePath
}
// _do=>_doc,_documents,_downloads
if
(
filePath
.
indexOf
(
'
_www
'
)
===
0
||
filePath
.
indexOf
(
'
_do
'
)
===
0
)
{
return
'
file://
'
+
handleLocalPath
(
filePath
)
}
const
pages
=
getCurrentPages
();
if
(
pages
.
length
)
{
return
addBase
(
getRealRoute
(
pages
[
pages
.
length
-
1
].
$page
.
route
,
filePath
).
substr
(
1
))
...
...
packages/uni-app-plus/dist/view.css
浏览文件 @
eb2f83a1
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/view.umd.js
浏览文件 @
eb2f83a1
此差异已折叠。
点击以展开。
packages/uni-cli-shared/template/__uniappview.html
浏览文件 @
eb2f83a1
...
...
@@ -5,6 +5,9 @@
<meta
charset=
"UTF-8"
/>
<script>
var
__UniViewStartTime__
=
Date
.
now
();
document
.
addEventListener
(
'
DOMContentLoaded
'
,
function
()
{
document
.
documentElement
.
style
.
fontSize
=
document
.
documentElement
.
clientWidth
/
20
+
'
px
'
})
var
coverSupport
=
'
CSS
'
in
window
&&
typeof
CSS
.
supports
===
'
function
'
&&
(
CSS
.
supports
(
'
top: env(a)
'
)
||
CSS
.
supports
(
'
top: constant(a)
'
))
document
.
write
(
...
...
@@ -12,16 +15,6 @@
(
coverSupport
?
'
, viewport-fit=cover
'
:
''
)
+
'
" />
'
)
</script>
<title>
View
</title>
<style>
*
{
-webkit-tap-highlight-color
:
rgba
(
0
,
0
,
0
,
0
);
-webkit-tap-highlight-color
:
transparent
;
}
input
[
type
=
"search"
i
]
::-webkit-search-cancel-button
{
display
:
none
;
}
</style>
<link
rel=
"stylesheet"
href=
"view.css"
/>
</head>
...
...
packages/uni-template-compiler/__tests__/compiler-app-plus-extra.service.spec.js
浏览文件 @
eb2f83a1
...
...
@@ -60,8 +60,8 @@ describe('codegen', () => {
})
it
(
'
generate text with multiple statements
'
,
()
=>
{
assertCodegen
(
'
<div>A{{ d | e | f }}B{{text}}C</div>
'
,
`with(this){return _c('div',[_v((_$s(0,'t0',_s(_f("f")(_f("e")(d)))))+(_$s(0,'t1',_s(text))))])}`
`<div :id="'a'+b">A{{ d | e | f }}B{{text}}C</div>`
,
`with(this){return _c('div',
{attrs:{"id":_$s(0,'a-id','a'+b),"_i":0}},
[_v((_$s(0,'t0',_s(_f("f")(_f("e")(d)))))+(_$s(0,'t1',_s(text))))])}`
)
})
...
...
packages/uni-template-compiler/__tests__/demo.js
浏览文件 @
eb2f83a1
const
compiler
=
require
(
'
../lib
'
)
const
res
=
compiler
.
compile
(
`
<div
><block v-for="item in items"><div></div><div></div></block>
</div>
<div
:id="'a'+b">A{{ d | e | f }}B{{text}}C
</div>
`
,
{
resourcePath
:
'
/User/fxy/Documents/test.wxml
'
,
isReservedTag
:
function
(
tag
)
{
...
...
packages/uni-template-compiler/lib/app/util.js
浏览文件 @
eb2f83a1
const
VARS
=
[
'
true
'
,
'
false
'
,
'
null
'
]
const
NUMBER_RE
=
/^-
?\d
*
(\.\d
+
)?
$/
const
{
parseExpression
}
=
require
(
'
@babel/parser
'
)
const
t
=
require
(
'
@babel/types
'
)
const
ID
=
'
_i
'
const
ITERATOR1
=
'
$1
'
...
...
@@ -16,12 +18,12 @@ function isVar (str) {
if
(
!
str
)
{
return
false
}
const
firstLetter
=
str
[
0
]
const
expr
=
parseExpression
(
str
)
if
(
firstLetter
===
'
"
'
||
// string
firstLetter
===
'
\'
'
||
// string
VARS
.
includes
(
str
)
||
// boolean | null
NUMBER_RE
.
test
(
str
)
// number
t
.
isStringLiteral
(
expr
)
||
t
.
isNumericLiteral
(
expr
)
||
t
.
isBooleanLiteral
(
expr
)
||
t
.
isNullLiteral
(
expr
)
)
{
return
false
}
...
...
src/platforms/app-plus/helpers/get-real-path.js
浏览文件 @
eb2f83a1
...
...
@@ -3,8 +3,20 @@ import getRealRoute from 'uni-helpers/get-real-route'
const
SCHEME_RE
=
/^
([
a-z-
]
+:
)?\/\/
/i
const
DATA_RE
=
/^data:.*,.*/
// 处理 Android 平台解压与非解压模式下获取的路径不一致的情况
function
handleLocalPath
(
filePath
)
{
return
plus
.
io
.
convertLocalFileSystemURL
(
filePath
)
.
replace
(
/^
\/?
apps
\/
/
,
'
/android_asset/apps/
'
)
.
replace
(
/
\/
$/
,
''
)
}
let
wwwPath
function
addBase
(
filePath
)
{
return
filePath
if
(
!
wwwPath
)
{
// 需要时,初始化一次,外部直接初始化,需要等 plusready
wwwPath
=
'
file://
'
+
handleLocalPath
(
'
_www
'
)
+
'
/
'
}
return
wwwPath
+
filePath
}
export
default
function
getRealPath
(
filePath
)
{
...
...
@@ -20,6 +32,11 @@ export default function getRealPath (filePath) {
return
filePath
}
// _do=>_doc,_documents,_downloads
if
(
filePath
.
indexOf
(
'
_www
'
)
===
0
||
filePath
.
indexOf
(
'
_do
'
)
===
0
)
{
return
'
file://
'
+
handleLocalPath
(
filePath
)
}
const
pages
=
getCurrentPages
()
if
(
pages
.
length
)
{
return
addBase
(
getRealRoute
(
pages
[
pages
.
length
-
1
].
$page
.
route
,
filePath
).
substr
(
1
))
...
...
src/platforms/app-plus/view/framework/plugins/event.js
浏览文件 @
eb2f83a1
...
...
@@ -11,16 +11,12 @@ export function initEvent (Vue) {
})
Vue
.
prototype
.
$handleVModelEvent
=
function
(
nid
,
value
)
{
vd
.
ad
dUIEvent
(
this
.
_$id
,
nid
,
{
vd
.
sen
dUIEvent
(
this
.
_$id
,
nid
,
{
type
:
'
input
'
,
target
:
{
value
}
})
// 使用 setTimeout 做批量同步
setTimeout
(()
=>
{
vd
.
sendUIEvent
()
},
0
)
}
Vue
.
prototype
.
$handleViewEvent
=
function
(
$vueEvent
,
options
)
{
...
...
@@ -39,11 +35,7 @@ export function initEvent (Vue) {
delete
$event
.
preventDefault
delete
$event
.
stopPropagation
delete
$event
.
options
vd
.
addUIEvent
(
cid
,
nid
,
$event
)
// 使用 setTimeout 做批量同步
setTimeout
(()
=>
{
vd
.
sendUIEvent
()
},
0
)
// 实时发送,延迟的话,会导致 touch 类事件被合并,影响实际业务逻辑,比如 touchstart 中修改变量为 true,touchend 修改为 false
vd
.
sendUIEvent
(
cid
,
nid
,
$event
)
}
}
src/platforms/app-plus/view/framework/plugins/vdom-sync.js
浏览文件 @
eb2f83a1
...
...
@@ -13,8 +13,6 @@ export class VDomSync {
this
.
addBatchVData
=
[]
this
.
updateBatchVData
=
[]
this
.
vms
=
Object
.
create
(
null
)
this
.
uiEventBatchData
=
[]
}
addVData
(
cid
,
data
=
{})
{
...
...
@@ -37,22 +35,17 @@ export class VDomSync {
this
.
vms
[
vm
.
_$id
]
=
vm
}
addUIEvent
(
cid
,
nid
,
event
)
{
this
.
uiEventBatchData
.
push
([
cid
,
nid
,
event
])
}
sendUIEvent
()
{
if
(
this
.
uiEventBatchData
.
length
)
{
sendUIEvent
(
cid
,
nid
,
event
)
{
UniViewJSBridge
.
publishHandler
(
VD_SYNC
,
{
data
:
[
[
UI_EVENT
,
this
.
uiEventBatchData
]
[
UI_EVENT
,
[
[
cid
,
nid
,
event
]
]]
],
options
:
{
timestamp
:
Date
.
now
()
}
})
this
.
uiEventBatchData
.
length
=
0
}
}
flush
()
{
...
...
src/platforms/app-plus/view/index.css
浏览文件 @
eb2f83a1
*
{
margin
:
0
;
-webkit-tap-highlight-color
:
rgba
(
0
,
0
,
0
,
0
);
-webkit-tap-highlight-color
:
transparent
;
}
input
[
type
=
"search"
]
::-webkit-search-cancel-button
{
display
:
none
;
}
@font-face
{
font-weight
:
normal
;
font-style
:
normal
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录