Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
靖轩达人
uni-app
提交
1d08c3c8
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,发现更多精彩内容 >>
提交
1d08c3c8
编写于
11月 23, 2018
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整部分代码,方便支持optimize
上级
9063ea96
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
233 addition
and
211 deletion
+233
-211
build/webpack.config.js
build/webpack.config.js
+2
-1
build/webpack.config.test.js
build/webpack.config.test.js
+1
-0
lib/h5/main.js
lib/h5/main.js
+5
-3
packages/uni-h5/dist/index.css
packages/uni-h5/dist/index.css
+1
-1
packages/uni-h5/dist/index.umd.min.js
packages/uni-h5/dist/index.umd.min.js
+1
-1
src/core/view/components/index.js
src/core/view/components/index.js
+1
-40
src/core/vue.js
src/core/vue.js
+27
-0
src/platforms/h5/components/index.js
src/platforms/h5/components/index.js
+17
-0
src/platforms/h5/components/system-routes/choose-location/index.vue
...rms/h5/components/system-routes/choose-location/index.vue
+74
-69
src/platforms/h5/components/system-routes/open-location/index.vue
...forms/h5/components/system-routes/open-location/index.vue
+104
-96
src/platforms/h5/components/system-routes/system-header.vue
src/platforms/h5/components/system-routes/system-header.vue
+0
-0
未找到文件。
build/webpack.config.js
浏览文件 @
1d08c3c8
...
...
@@ -28,7 +28,8 @@ module.exports = {
'
uni-shared
'
:
resolve
(
'
src/shared
'
),
'
uni-mixins
'
:
resolve
(
'
src/core/view/mixins
'
),
'
uni-helpers
'
:
resolve
(
'
src/core/helpers
'
),
'
uni-platform
'
:
resolve
(
'
src/platforms/
'
+
process
.
env
.
UNI_PLATFORM
)
'
uni-platform
'
:
resolve
(
'
src/platforms/
'
+
process
.
env
.
UNI_PLATFORM
),
'
uni-components
'
:
resolve
(
'
src/core/view/components
'
)
}
},
module
:
{
...
...
build/webpack.config.test.js
浏览文件 @
1d08c3c8
...
...
@@ -40,6 +40,7 @@ config.plugins = config.plugins.concat([
__PLATFORM__
:
JSON
.
stringify
(
process
.
env
.
UNI_PLATFORM
)
}),
new
webpack
.
ProvidePlugin
({
'
console
'
:
[
resolve
(
'
src/core/helpers/console
'
),
'
default
'
],
'
UniViewJSBridge
'
:
[
resolve
(
'
src/core/view/bridge
'
)],
'
UniServiceJSBridge
'
:
[
resolve
(
'
src/core/service/bridge
'
)]
})
...
...
lib/h5/main.js
浏览文件 @
1d08c3c8
...
...
@@ -20,8 +20,8 @@ const {
}
=
require
(
'
uni-service
'
)
global
.
uni
=
Object
.
assign
(
uni
,
require
(
'
uni-view
'
).
default
)
global
.
wx
=
global
.
uni
global
.
wx
=
global
.
uni
global
.
getApp
=
getApp
global
.
getCurrentPages
=
getCurrentPages
...
...
@@ -34,4 +34,6 @@ Vue.use(require('uni-view/plugins').default, {
routes
:
__uniRoutes
})
require
(
'
uni-view/components
'
)
require
(
'
uni-core/vue
'
)
require
(
'
uni-platform/components
'
)
require
(
'
uni-components
'
)
packages/uni-h5/dist/index.css
浏览文件 @
1d08c3c8
此差异已折叠。
点击以展开。
packages/uni-h5/dist/index.umd.min.js
浏览文件 @
1d08c3c8
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
src/core/view/components/index.js
浏览文件 @
1d08c3c8
import
Vue
from
'
vue
'
// 使用白名单过滤(前期有一批自定义组件使用了 uni-)
import
tags
from
'
uni-helpers/tags
'
import
baseMixin
from
'
uni-mixins/base
'
// const uniRegex = /^uni-/i
// const htmlRegex = /^html:/i
// const svgRegex = /^svg:/i
const
oldIsReservedTag
=
Vue
.
config
.
isReservedTag
Vue
.
config
.
isReservedTag
=
function
(
tag
)
{
return
tags
.
indexOf
(
tag
)
!==
-
1
||
oldIsReservedTag
(
tag
)
}
// Vue.config.parsePlatformTagName = function(tag) {
// return tag.replace(htmlRegex, '').replace(svgRegex, '')
// }
Vue
.
config
.
ignoredElements
=
tags
const
oldGetTagNamespace
=
Vue
.
config
.
getTagNamespace
const
conflictTags
=
[
'
switch
'
,
'
image
'
,
'
text
'
,
'
view
'
]
Vue
.
config
.
getTagNamespace
=
function
(
tag
)
{
if
(
~
conflictTags
.
indexOf
(
tag
))
{
// svg 部分标签名称与 uni 标签冲突
return
false
}
return
oldGetTagNamespace
(
tag
)
||
false
}
Vue
.
config
.
errorHandler
=
function
(
err
,
vm
,
info
)
{
console
.
error
(
'
errorHandler
'
,
err
,
vm
,
info
)
}
const
requireComponents
=
[
// frameworkComponents
/* eslint-disable no-undef */
require
.
context
(
'
../../../platforms/
'
+
__PLATFORM__
+
'
/components
'
,
true
,
/index
\.
vue$/
),
// baseComponents
require
.
context
(
'
./
'
,
true
,
/index
\.
vue$/
),
require
.
context
(
'
../../../platforms/
'
+
__PLATFORM__
+
'
/view/components
'
,
true
,
/index
\.
vue$/
)
...
...
@@ -54,9 +17,7 @@ requireComponents.forEach((components, index) => {
componentConfig
.
mixins
=
componentConfig
.
mixins
?
[].
concat
(
baseMixin
,
componentConfig
.
mixins
)
:
[
baseMixin
]
if
(
index
>
0
)
{
componentConfig
.
name
=
'
VUni
'
+
componentConfig
.
name
}
componentConfig
.
name
=
'
VUni
'
+
componentConfig
.
name
// 全局注册组件
Vue
.
component
(
componentConfig
.
name
,
componentConfig
)
...
...
src/core/vue.js
0 → 100644
浏览文件 @
1d08c3c8
import
Vue
from
'
vue
'
// 使用白名单过滤(前期有一批自定义组件使用了 uni-)
import
tags
from
'
uni-helpers/tags
'
const
oldIsReservedTag
=
Vue
.
config
.
isReservedTag
Vue
.
config
.
isReservedTag
=
function
(
tag
)
{
return
tags
.
indexOf
(
tag
)
!==
-
1
||
oldIsReservedTag
(
tag
)
}
Vue
.
config
.
ignoredElements
=
tags
const
oldGetTagNamespace
=
Vue
.
config
.
getTagNamespace
const
conflictTags
=
[
'
switch
'
,
'
image
'
,
'
text
'
,
'
view
'
]
Vue
.
config
.
getTagNamespace
=
function
(
tag
)
{
if
(
~
conflictTags
.
indexOf
(
tag
))
{
// svg 部分标签名称与 uni 标签冲突
return
false
}
return
oldGetTagNamespace
(
tag
)
||
false
}
Vue
.
config
.
errorHandler
=
function
(
err
,
vm
,
info
)
{
console
.
error
(
'
errorHandler
'
,
err
,
vm
,
info
)
}
src/platforms/h5/components/index.js
0 → 100644
浏览文件 @
1d08c3c8
import
Vue
from
'
vue
'
import
App
from
'
./app
'
import
Page
from
'
./page
'
import
AsyncError
from
'
./async-error
'
import
AsyncLoading
from
'
./async-loading
'
import
ChooseLocation
from
'
./system-routes/choose-location
'
import
OpenLocation
from
'
./system-routes/open-location
'
import
PreviewImage
from
'
./system-routes/preview-image
'
Vue
.
component
(
App
.
name
,
App
)
Vue
.
component
(
Page
.
name
,
Page
)
Vue
.
component
(
AsyncError
.
name
,
AsyncError
)
Vue
.
component
(
AsyncLoading
.
name
,
AsyncLoading
)
Vue
.
component
(
ChooseLocation
.
name
,
ChooseLocation
)
Vue
.
component
(
OpenLocation
.
name
,
OpenLocation
)
Vue
.
component
(
PreviewImage
.
name
,
PreviewImage
)
src/platforms/h5/components/system-routes/choose-location/index.vue
浏览文件 @
1d08c3c8
<
template
>
<div
class=
"uni-system-choose-location"
>
<
template
>
<div
class=
"uni-system-choose-location"
>
<system-header
:confirm=
"!!data"
@
back=
"_back"
@
confirm=
"_choose"
>
选择位置
</system-header>
<div
class=
"map-content"
>
@
confirm=
"_choose"
>
选择位置
</system-header>
<div
class=
"map-content"
>
<iframe
:src=
"src"
allow=
"geolocation"
seamless
sandbox=
"allow-scripts allow-same-origin allow-forms"
frameborder=
"0"
/>
</div>
</div>
</
template
>
<
script
>
export
default
{
frameborder=
"0"
/>
</div>
</div>
</
template
>
<
script
>
import
SystemHeader
from
'
../system-header
'
export
default
{
name
:
'
SystemChooseLocation
'
,
data
()
{
return
{
src
:
''
,
data
:
null
}
},
mounted
()
{
var
key
=
'
WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS
'
this
.
src
=
`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=
${
key
}
&referer=uniapp`
window
.
addEventListener
(
'
message
'
,
(
event
)
=>
{
var
loc
=
event
.
data
if
(
loc
&&
loc
.
module
===
'
locationPicker
'
)
{
this
.
data
=
{
name
:
loc
.
poiname
,
address
:
loc
.
poiaddress
,
latitude
:
loc
.
latlng
.
lat
,
longitude
:
loc
.
latlng
.
lng
}
}
},
false
)
},
methods
:
{
_choose
()
{
if
(
this
.
data
)
{
UniViewJSBridge
.
publishHandler
(
'
onChooseLocation
'
,
this
.
data
)
getApp
().
$router
.
back
()
}
},
_back
()
{
UniViewJSBridge
.
publishHandler
(
'
onChooseLocation
'
,
null
)
getApp
().
$router
.
back
()
}
}
}
</
script
>
<
style
>
.uni-system-choose-location
{
display
:
block
;
position
:
fixed
;
left
:
0
;
top
:
0
;
width
:
100%
;
height
:
100%
;
background
:
#f8f8f8
;
}
.map-content
{
position
:
absolute
;
left
:
0
;
top
:
44px
;
width
:
100%
;
bottom
:
0
;
overflow
:
hidden
;
}
.map-content
>
iframe
{
width
:
100%
;
height
:
100%
;
}
components
:
{
SystemHeader
},
data
()
{
return
{
src
:
''
,
data
:
null
}
},
mounted
()
{
var
key
=
'
WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS
'
this
.
src
=
`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=
${
key
}
&referer=uniapp`
window
.
addEventListener
(
'
message
'
,
(
event
)
=>
{
var
loc
=
event
.
data
if
(
loc
&&
loc
.
module
===
'
locationPicker
'
)
{
this
.
data
=
{
name
:
loc
.
poiname
,
address
:
loc
.
poiaddress
,
latitude
:
loc
.
latlng
.
lat
,
longitude
:
loc
.
latlng
.
lng
}
}
},
false
)
},
methods
:
{
_choose
()
{
if
(
this
.
data
)
{
UniViewJSBridge
.
publishHandler
(
'
onChooseLocation
'
,
this
.
data
)
getApp
().
$router
.
back
()
}
},
_back
()
{
UniViewJSBridge
.
publishHandler
(
'
onChooseLocation
'
,
null
)
getApp
().
$router
.
back
()
}
}
}
</
script
>
<
style
>
.uni-system-choose-location
{
display
:
block
;
position
:
fixed
;
left
:
0
;
top
:
0
;
width
:
100%
;
height
:
100%
;
background
:
#f8f8f8
;
}
.map-content
{
position
:
absolute
;
left
:
0
;
top
:
44px
;
width
:
100%
;
bottom
:
0
;
overflow
:
hidden
;
}
.map-content
>
iframe
{
width
:
100%
;
height
:
100%
;
}
</
style
>
src/platforms/h5/components/system-routes/open-location/index.vue
浏览文件 @
1d08c3c8
<
template
>
<div
class=
"uni-system-open-location"
>
<system-header
@
back=
"_back"
>
位置
</system-header>
<div
class=
"map-content"
>
<
template
>
<div
class=
"uni-system-open-location"
>
<system-header
@
back=
"_back"
>
位置
</system-header>
<div
class=
"map-content"
>
<iframe
ref=
"map"
:src=
"src"
allow=
"geolocation"
sandbox=
"allow-scripts allow-same-origin allow-forms"
frameborder=
"0"
@
load=
"_load"
/>
<!-- 去这里 -->
frameborder=
"0"
@
load=
"_load"
/>
<!-- 去这里 -->
<div
v-if=
"isPoimarkerSrc"
class=
"actTonav"
@
click=
"_nav"
/>
</div>
</div>
</
template
>
<
script
>
const
key
=
'
WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS
'
const
referer
=
'
uniapp
'
const
poimarkerSrc
=
'
https://apis.map.qq.com/tools/poimarker
'
export
default
{
name
:
'
SystemOpenLocation
'
,
data
()
{
const
{
latitude
,
longitude
,
scale
,
name
,
address
}
=
this
.
$route
.
params
return
{
latitude
,
longitude
,
scale
,
name
,
address
,
src
:
''
,
isPoimarkerSrc
:
false
}
},
mounted
()
{
if
(
this
.
latitude
&&
this
.
longitude
)
{
this
.
src
=
`
${
poimarkerSrc
}
?type=0&marker=coord:
${
this
.
latitude
}
,
${
this
.
longitude
}
;title:
${
this
.
name
}
;addr:
${
this
.
address
}
;&key=
${
key
}
&referer=
${
referer
}
`
}
},
methods
:
{
_back
()
{
if
(
this
.
$refs
.
map
.
src
.
indexOf
(
poimarkerSrc
)
!==
0
)
{
this
.
$refs
.
map
.
src
=
this
.
src
}
else
{
getApp
().
$router
.
back
()
}
},
_load
()
{
if
(
this
.
$refs
.
map
.
src
.
indexOf
(
poimarkerSrc
)
===
0
)
{
this
.
isPoimarkerSrc
=
true
}
else
{
this
.
isPoimarkerSrc
=
false
}
},
_nav
()
{
var
url
=
`https://apis.map.qq.com/uri/v1/routeplan?type=drive&to=
${
encodeURIComponent
(
this
.
name
)}
&tocoord=
${
this
.
latitude
}
,
${
this
.
longitude
}
&referer=
${
referer
}
`
this
.
$refs
.
map
.
src
=
url
}
}
}
</
script
>
<
style
>
.uni-system-open-location
{
display
:
block
;
position
:
fixed
;
left
:
0
;
top
:
0
;
width
:
100%
;
height
:
100%
;
background
:
#f8f8f8
;
}
.map-content
{
position
:
absolute
;
left
:
0
;
top
:
44px
;
width
:
100%
;
bottom
:
0
;
overflow
:
hidden
;
}
.map-content
>
iframe
{
width
:
100%
;
height
:
100%
;
border
:
none
;
}
.actTonav
{
position
:
absolute
;
right
:
16px
;
bottom
:
56px
;
width
:
60px
;
height
:
60px
;
border-radius
:
60px
;
}
@
click=
"_nav"
/>
</div>
</div>
</
template
>
<
script
>
import
SystemHeader
from
'
../system-header
'
const
key
=
'
WXTBZ-6WERU-ECCVS-BZJCK-LW5OJ-SIBOS
'
const
referer
=
'
uniapp
'
const
poimarkerSrc
=
'
https://apis.map.qq.com/tools/poimarker
'
export
default
{
name
:
'
SystemOpenLocation
'
,
components
:
{
SystemHeader
},
data
()
{
const
{
latitude
,
longitude
,
scale
,
name
,
address
}
=
this
.
$route
.
params
return
{
latitude
,
longitude
,
scale
,
name
,
address
,
src
:
''
,
isPoimarkerSrc
:
false
}
},
mounted
()
{
if
(
this
.
latitude
&&
this
.
longitude
)
{
this
.
src
=
`
${
poimarkerSrc
}
?type=0&marker=coord:
${
this
.
latitude
}
,
${
this
.
longitude
}
;title:
${
this
.
name
}
;addr:
${
this
.
address
}
;&key=
${
key
}
&referer=
${
referer
}
`
}
},
methods
:
{
_back
()
{
if
(
this
.
$refs
.
map
.
src
.
indexOf
(
poimarkerSrc
)
!==
0
)
{
this
.
$refs
.
map
.
src
=
this
.
src
}
else
{
getApp
().
$router
.
back
()
}
},
_load
()
{
if
(
this
.
$refs
.
map
.
src
.
indexOf
(
poimarkerSrc
)
===
0
)
{
this
.
isPoimarkerSrc
=
true
}
else
{
this
.
isPoimarkerSrc
=
false
}
},
_nav
()
{
var
url
=
`https://apis.map.qq.com/uri/v1/routeplan?type=drive&to=
${
encodeURIComponent
(
this
.
name
)}
&tocoord=
${
this
.
latitude
}
,
${
this
.
longitude
}
&referer=
${
referer
}
`
this
.
$refs
.
map
.
src
=
url
}
}
}
</
script
>
<
style
>
.uni-system-open-location
{
display
:
block
;
position
:
fixed
;
left
:
0
;
top
:
0
;
width
:
100%
;
height
:
100%
;
background
:
#f8f8f8
;
}
.map-content
{
position
:
absolute
;
left
:
0
;
top
:
44px
;
width
:
100%
;
bottom
:
0
;
overflow
:
hidden
;
}
.map-content
>
iframe
{
width
:
100%
;
height
:
100%
;
border
:
none
;
}
.actTonav
{
position
:
absolute
;
right
:
16px
;
bottom
:
56px
;
width
:
60px
;
height
:
60px
;
border-radius
:
60px
;
}
</
style
>
src/platforms/h5/components/system-routes/system-header
/index
.vue
→
src/platforms/h5/components/system-routes/system-header.vue
浏览文件 @
1d08c3c8
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录