Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yangkaifeng
uni-app
提交
96699f6a
U
uni-app
项目概览
yangkaifeng
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
3
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,发现更多精彩内容 >>
提交
96699f6a
编写于
1月 10, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
上级
a6dc7f92
2203abe3
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
182 addition
and
47 deletion
+182
-47
build/manifest.js
build/manifest.js
+3
-1
docs/component/swiper.md
docs/component/swiper.md
+6
-5
docs/frame.md
docs/frame.md
+31
-0
jest.config.js
jest.config.js
+1
-1
packages/uni-template-compiler/lib/app/parser/tag-parser.js
packages/uni-template-compiler/lib/app/parser/tag-parser.js
+1
-1
packages/uni-template-compiler/lib/auto-components.js
packages/uni-template-compiler/lib/auto-components.js
+3
-3
packages/uni-template-compiler/lib/index.js
packages/uni-template-compiler/lib/index.js
+5
-2
packages/uni-template-compiler/lib/module-toutiao.js
packages/uni-template-compiler/lib/module-toutiao.js
+24
-0
packages/vue-cli-plugin-uni-optimize/packages/webpack-optimize-plugin/api.js
...ugin-uni-optimize/packages/webpack-optimize-plugin/api.js
+21
-2
packages/vue-cli-plugin-uni-optimize/packages/webpack-optimize-plugin/component.js
...ni-optimize/packages/webpack-optimize-plugin/component.js
+2
-0
packages/webpack-uni-mp-loader/lib/plugin/generate-json.js
packages/webpack-uni-mp-loader/lib/plugin/generate-json.js
+3
-0
src/core/service/api/context/create-map-context.js
src/core/service/api/context/create-map-context.js
+23
-17
src/core/view/components/swiper/index.vue
src/core/view/components/swiper/index.vue
+7
-0
src/platforms/app-plus/service/api/network/request.js
src/platforms/app-plus/service/api/network/request.js
+1
-1
src/platforms/app-plus/view/components/map/index.vue
src/platforms/app-plus/view/components/map/index.vue
+51
-14
未找到文件。
build/manifest.js
浏览文件 @
96699f6a
...
@@ -31,6 +31,8 @@ const DEPS = {
...
@@ -31,6 +31,8 @@ const DEPS = {
[
'
/platforms/h5/components/system-routes/open-location/index.vue
'
,
'
OpenLocation
'
]
[
'
/platforms/h5/components/system-routes/open-location/index.vue
'
,
'
OpenLocation
'
]
],
],
'
previewImage
'
:
[
'
previewImage
'
:
[
[
'
/core/view/components/swiper/index.vue
'
,
'
Swiper
'
],
[
'
/core/view/components/swiper-item/index.vue
'
,
'
SwiperItem
'
],
[
'
/platforms/h5/components/system-routes/preview-image/index.vue
'
,
'
PreviewImage
'
]
[
'
/platforms/h5/components/system-routes/preview-image/index.vue
'
,
'
PreviewImage
'
]
],
],
'
showToast
'
:
TOAST_DEPS
,
'
showToast
'
:
TOAST_DEPS
,
...
@@ -138,4 +140,4 @@ module.exports = {
...
@@ -138,4 +140,4 @@ module.exports = {
JSON
.
stringify
(
manifestJson
,
null
,
4
)
JSON
.
stringify
(
manifestJson
,
null
,
4
)
)
)
}
}
}
}
docs/component/swiper.md
浏览文件 @
96699f6a
...
@@ -23,11 +23,12 @@
...
@@ -23,11 +23,12 @@
|acceleration|Boolean|false|当开启时,会根据滑动速度,连续滑动多屏|支付宝小程序|
|acceleration|Boolean|false|当开启时,会根据滑动速度,连续滑动多屏|支付宝小程序|
|disable-programmatic-animation|Boolean|false|是否禁用代码变动触发 swiper 切换时使用动画。|支付宝小程序|
|disable-programmatic-animation|Boolean|false|是否禁用代码变动触发 swiper 切换时使用动画。|支付宝小程序|
|display-multiple-items|Number|1|同时显示的滑块数量|支付宝小程序不支持|
|display-multiple-items|Number|1|同时显示的滑块数量|支付宝小程序不支持|
|skip-hidden-item-layout|Boolean|false|是否跳过未显示的滑块布局,设为 true 可优化复杂情况下的滑动性能,但会丢失隐藏状态滑块的布局信息|5+App、微信小程序|
|skip-hidden-item-layout|Boolean|false|是否跳过未显示的滑块布局,设为 true 可优化复杂情况下的滑动性能,但会丢失隐藏状态滑块的布局信息|5+App、微信小程序|
|disable-touch|Boolean|false|是否禁止用户 touch 操作|支付宝小程序|
|disable-touch|Boolean|false|是否禁止用户 touch 操作|App 2.5.5+、H5 2.5.5+、支付宝小程序|
|touchable|Boolean|true|是否监听用户的触摸事件|头条小程序|
|disable-touch|Boolean|false|是否禁止用户 touch 操作|App 2.5.5+、H5 2.5.5+、支付宝小程序、头条小程序(只在初始化时有效,不能动态变更)|
|touchable|Boolean|true|是否监听用户的触摸事件,只在初始化时有效,不能动态变更|头条小程序(uni-app 2.5.5+ 推荐统一使用 disable-touch)|
|easing-function|String|default|指定 swiper 切换缓动动画类型,有效值:default、linear、easeInCubic、easeOutCubic、easeInOutCubic|微信小程序|
|easing-function|String|default|指定 swiper 切换缓动动画类型,有效值:default、linear、easeInCubic、easeOutCubic、easeInOutCubic|微信小程序|
|@change|EventHandle||current 改变时会触发 change 事件,event.detail = {current: current, source: source}||
|@change|EventHandle||current 改变时会触发 change 事件,event.detail = {current: current, source: source}||
|@transition|EventHandle||swiper-item 的位置发生改变时会触发 transition 事件,event.detail = {dx: dx, dy: dy}|5+App、H5、微信小程序、支付宝小程序、头条小程序、QQ小程序|
|@transition|EventHandle||swiper-item 的位置发生改变时会触发 transition 事件,event.detail = {dx: dx, dy: dy}|5+App、H5、微信小程序、支付宝小程序、头条小程序、QQ小程序|
|@animationfinish|EventHandle||动画结束时会触发 animationfinish 事件,event.detail = {current: current, source: source}|头条小程序不支持|
|@animationfinish|EventHandle||动画结束时会触发 animationfinish 事件,event.detail = {current: current, source: source}|头条小程序不支持|
...
@@ -48,7 +49,7 @@ change 事件返回 detail 中包含一个 source 字段,表示导致变更的
...
@@ -48,7 +49,7 @@ change 事件返回 detail 中包含一个 source 字段,表示导致变更的
-
注意:其中只可放置
``<swiper-item>``
组件,否则会导致未定义的行为。
-
注意:其中只可放置
``<swiper-item>``
组件,否则会导致未定义的行为。
-
如果遇到current、current-item-id属性设置不生效的问题参考:
[
组件属性设置不生效解决办法
](
/use?id=%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98
)
-
如果遇到current、current-item-id属性设置不生效的问题参考:
[
组件属性设置不生效解决办法
](
/use?id=%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98
)
-
banner图的切换效果和指示器的样式,有多种风格可自定义,可在
[
uni-app插件市场
](
https://ext.dcloud.net.cn/search?q=%E8%BD%AE%E6%92%AD
)
搜索
-
banner图的切换效果和指示器的样式,有多种风格可自定义,可在
[
uni-app插件市场
](
https://ext.dcloud.net.cn/search?q=%E8%BD%AE%E6%92%AD
)
搜索
-
swiper在App的vue中、百度支付宝头条QQ小程序中,不支持内嵌video、map等原生组件。在微信基础库2.4.4起和App nvue2.1.5起支持内嵌原生组件。竖向的swiper内嵌视频可实现抖音、映客等视频垂直拖动切换效果。
-
swiper在App的vue中、百度支付宝头条QQ小程序中,不支持内嵌video、map等原生组件。在微信基础库2.4.4起和App nvue2.1.5起支持内嵌原生组件。竖向的swiper内嵌视频可实现抖音、映客等视频垂直拖动切换效果。
-
同时监听 change transition,开始滑动时触发transition, 放开手后,在ios平台触发顺序为 transition... change,Android/微信小程序/支付宝为 transition... change transition...
-
同时监听 change transition,开始滑动时触发transition, 放开手后,在ios平台触发顺序为 transition... change,Android/微信小程序/支付宝为 transition... change transition...
#### swiper-item
#### swiper-item
...
...
docs/frame.md
浏览文件 @
96699f6a
...
@@ -1178,6 +1178,37 @@ export default {
...
@@ -1178,6 +1178,37 @@ export default {
- 各个`script`标签会分别被打包至对应支持平台,不需要额外写条件编译
- 各个`script`标签会分别被打包至对应支持平台,不需要额外写条件编译
- 自`HBuilderX 2.2.5`开始,不推荐使用各个小程序自有的引入方式,推荐使用`script`标签引入
- 自`HBuilderX 2.2.5`开始,不推荐使用各个小程序自有的引入方式,推荐使用`script`标签引入
## renderjs
uni-app 2.5.5+ 在 [WXS](?id=wxs) 的基础上扩展了 renderjs,以 vue 组件的写法运行在 view 层。仅支持 App([V3](https://ask.dcloud.net.cn/article/36599) 且不含 nvue)、H5。
### 使用方式
设置 script 节点的 lang 为 renderjs
```
html
<script
module=
"test"
lang=
"renderjs"
>
export default {
mounted() {
// ...
},
methods: {
// ...
}
}
</script>
```
### 示例
* [echarts 示例](https://ext.dcloud.net.cn/plugin?id=1207)
### 注意事项
* 可以使用 dom、bom API 不可直接访问 service 层数据
* view 层和 service 层通讯方式与 [WXS](?id=wxs) 一致
* 观测更新的数据在 view 层可以直接访问到
* 不要直接引用大型类库,推荐通过动态创建 script 方式引用
* view 层的页面引用资源的路径相对于根目录计算,例如:./static/test.js
## 致谢
## 致谢
...
...
jest.config.js
浏览文件 @
96699f6a
...
@@ -7,7 +7,7 @@ module.exports = {
...
@@ -7,7 +7,7 @@ module.exports = {
collectCoverageFrom
:
[
'
packages/*/src/**/*.js
'
],
collectCoverageFrom
:
[
'
packages/*/src/**/*.js
'
],
moduleFileExtensions
:
[
'
js
'
,
'
json
'
],
moduleFileExtensions
:
[
'
js
'
,
'
json
'
],
moduleNameMapper
:
{
moduleNameMapper
:
{
'
^@dcloudio/(.*?)$
'
:
'
<rootDir>/packages/$1
/src
'
'
^@dcloudio/(.*?)$
'
:
'
<rootDir>/packages/$1
'
},
},
rootDir
:
__dirname
,
rootDir
:
__dirname
,
testMatch
:
[
'
<rootDir>/packages/**/__tests__/**/*spec.(t|j)s
'
]
testMatch
:
[
'
<rootDir>/packages/**/__tests__/**/*spec.(t|j)s
'
]
...
...
packages/uni-template-compiler/lib/app/parser/tag-parser.js
浏览文件 @
96699f6a
...
@@ -6,7 +6,7 @@ const {
...
@@ -6,7 +6,7 @@ const {
getTagName
getTagName
}
=
require
(
'
../../h5
'
)
}
=
require
(
'
../../h5
'
)
const
tags
=
require
(
'
../../../..
/uni-cli-shared/lib/tags
'
)
const
tags
=
require
(
'
@dcloudio
/uni-cli-shared/lib/tags
'
)
// 仅限 view 层
// 仅限 view 层
module
.
exports
=
function
parseTag
(
el
)
{
module
.
exports
=
function
parseTag
(
el
)
{
...
...
packages/uni-template-compiler/lib/auto-components.js
浏览文件 @
96699f6a
...
@@ -6,15 +6,15 @@ const {
...
@@ -6,15 +6,15 @@ const {
const
{
const
{
removeExt
removeExt
}
=
require
(
'
../..
/uni-cli-shared/lib/util
'
)
}
=
require
(
'
@dcloudio
/uni-cli-shared/lib/util
'
)
const
{
const
{
getAutoComponents
getAutoComponents
}
=
require
(
'
../..
/uni-cli-shared/lib/pages
'
)
}
=
require
(
'
@dcloudio
/uni-cli-shared/lib/pages
'
)
const
{
const
{
updateUsingAutoImportComponents
updateUsingAutoImportComponents
}
=
require
(
'
../..
/uni-cli-shared/lib/cache
'
)
}
=
require
(
'
@dcloudio
/uni-cli-shared/lib/cache
'
)
function
formatSource
(
source
)
{
function
formatSource
(
source
)
{
if
(
source
.
indexOf
(
'
@/
'
)
===
0
)
{
// 根目录
if
(
source
.
indexOf
(
'
@/
'
)
===
0
)
{
// 根目录
...
...
packages/uni-template-compiler/lib/index.js
浏览文件 @
96699f6a
...
@@ -8,7 +8,7 @@ const {
...
@@ -8,7 +8,7 @@ const {
compileToFunctions
,
compileToFunctions
,
ssrCompile
,
ssrCompile
,
ssrCompileToFunctions
ssrCompileToFunctions
}
=
require
(
'
../..
/vue-cli-plugin-uni/packages/vue-template-compiler
'
)
}
=
require
(
'
@dcloudio
/vue-cli-plugin-uni/packages/vue-template-compiler
'
)
const
platforms
=
require
(
'
./platforms
'
)
const
platforms
=
require
(
'
./platforms
'
)
const
traverseScript
=
require
(
'
./script/traverse
'
)
const
traverseScript
=
require
(
'
./script/traverse
'
)
...
@@ -19,6 +19,7 @@ const generateTemplate = require('./template/generate')
...
@@ -19,6 +19,7 @@ const generateTemplate = require('./template/generate')
const
compilerModule
=
require
(
'
./module
'
)
const
compilerModule
=
require
(
'
./module
'
)
const
compilerAlipayModule
=
require
(
'
./module-alipay
'
)
const
compilerAlipayModule
=
require
(
'
./module-alipay
'
)
const
compilerToutiaoModule
=
require
(
'
./module-toutiao
'
)
const
generateCodeFrame
=
require
(
'
./codeframe
'
)
const
generateCodeFrame
=
require
(
'
./codeframe
'
)
...
@@ -75,6 +76,8 @@ module.exports = {
...
@@ -75,6 +76,8 @@ module.exports = {
if
(
options
.
mp
.
platform
===
'
mp-alipay
'
)
{
if
(
options
.
mp
.
platform
===
'
mp-alipay
'
)
{
options
.
modules
.
push
(
compilerAlipayModule
)
options
.
modules
.
push
(
compilerAlipayModule
)
}
else
if
(
options
.
mp
.
platform
===
'
mp-toutiao
'
)
{
options
.
modules
.
push
(
compilerToutiaoModule
)
}
}
const
res
=
compileTemplate
(
source
,
Object
.
assign
(
options
,
{
const
res
=
compileTemplate
(
source
,
Object
.
assign
(
options
,
{
...
@@ -254,4 +257,4 @@ at ${resourcePath}.vue:1`)
...
@@ -254,4 +257,4 @@ at ${resourcePath}.vue:1`)
ssrCompile
,
ssrCompile
,
ssrCompileToFunctions
,
ssrCompileToFunctions
,
generateCodeFrame
generateCodeFrame
}
}
packages/uni-template-compiler/lib/module-toutiao.js
0 → 100644
浏览文件 @
96699f6a
module
.
exports
=
{
postTransformNode
(
el
)
{
if
(
el
.
tag
===
'
swiper
'
)
{
const
attrsMap
=
el
.
attrsMap
let
touchable
if
(
attrsMap
[
'
:disable-touch
'
])
{
touchable
=
`!(
${
attrsMap
[
'
:disable-touch
'
]}
)`
}
else
if
(
'
disable-touch
'
in
attrsMap
)
{
touchable
=
'
false
'
}
if
(
touchable
)
{
const
attr
=
el
.
attrs
.
find
(
attr
=>
attr
.
name
===
'
:touchable
'
)
if
(
attr
)
{
attr
.
value
=
touchable
}
else
{
el
.
attrs
.
push
({
name
:
'
:touchable
'
,
value
:
touchable
})
}
}
}
}
}
packages/vue-cli-plugin-uni-optimize/packages/webpack-optimize-plugin/api.js
浏览文件 @
96699f6a
const
fs
=
require
(
'
fs
'
)
const
fs
=
require
(
'
fs
'
)
const
path
=
require
(
'
path
'
)
const
path
=
require
(
'
path
'
)
const
updateComponents
=
require
(
'
./component
'
)
const
tmpDir
=
path
.
resolve
(
__dirname
,
'
../../.tmp
'
)
const
tmpDir
=
path
.
resolve
(
__dirname
,
'
../../.tmp
'
)
...
@@ -72,6 +73,12 @@ function updateAppComponents(paths) {
...
@@ -72,6 +73,12 @@ function updateAppComponents(paths) {
return
updateExportDefaultObject
(
paths
,
'
app-components.js
'
,
false
)
return
updateExportDefaultObject
(
paths
,
'
app-components.js
'
,
false
)
}
}
function
updateCoreComponents
(
paths
){
const
tags
=
process
.
UNI_TAGS
||
new
Set
()
Object
.
keys
(
paths
).
forEach
(
tag
=>
tags
.
add
(
tag
.
replace
(
/
([
a-z
])([
A-Z
])
/g
,
'
$1-$2
'
).
toLowerCase
()))
updateComponents
(
tags
)
}
function
updateAppMixins
(
paths
)
{
function
updateAppMixins
(
paths
)
{
return
updateExportDefaultObject
(
paths
,
'
app-mixins.js
'
,
false
,
true
)
return
updateExportDefaultObject
(
paths
,
'
app-mixins.js
'
,
false
,
true
)
}
}
...
@@ -93,6 +100,11 @@ const isAppComponents = filepath => {
...
@@ -93,6 +100,11 @@ const isAppComponents = filepath => {
filepath
.
indexOf
(
'
/platforms/
'
+
process
.
env
.
UNI_PLATFORM
+
'
/components/app/
'
)
===
0
filepath
.
indexOf
(
'
/platforms/
'
+
process
.
env
.
UNI_PLATFORM
+
'
/components/app/
'
)
===
0
}
}
const
isCoreComponents
=
filepath
=>
{
return
path
.
extname
(
filepath
)
===
'
.vue
'
&&
filepath
.
indexOf
(
'
/core/view/components/
'
)
===
0
}
const
isAppMixins
=
filepath
=>
{
const
isAppMixins
=
filepath
=>
{
return
path
.
extname
(
filepath
)
===
'
.js
'
&&
return
path
.
extname
(
filepath
)
===
'
.js
'
&&
filepath
.
indexOf
(
'
/platforms/
'
+
process
.
env
.
UNI_PLATFORM
+
'
/components/app/
'
)
===
0
filepath
.
indexOf
(
'
/platforms/
'
+
process
.
env
.
UNI_PLATFORM
+
'
/components/app/
'
)
===
0
...
@@ -113,6 +125,7 @@ function parseDeps(apis, manifest) {
...
@@ -113,6 +125,7 @@ function parseDeps(apis, manifest) {
const
apiProtocolPaths
=
Object
.
create
(
null
)
const
apiProtocolPaths
=
Object
.
create
(
null
)
const
invokeApiPaths
=
Object
.
create
(
null
)
const
invokeApiPaths
=
Object
.
create
(
null
)
const
appComponentsPaths
=
Object
.
create
(
null
)
const
appComponentsPaths
=
Object
.
create
(
null
)
const
coreComponentsPaths
=
Object
.
create
(
null
)
const
appMixinsPaths
=
Object
.
create
(
null
)
const
appMixinsPaths
=
Object
.
create
(
null
)
const
systemRoutesPaths
=
Object
.
create
(
null
)
const
systemRoutesPaths
=
Object
.
create
(
null
)
const
apiSubscribePaths
=
Object
.
create
(
null
)
const
apiSubscribePaths
=
Object
.
create
(
null
)
...
@@ -126,6 +139,9 @@ function parseDeps(apis, manifest) {
...
@@ -126,6 +139,9 @@ function parseDeps(apis, manifest) {
},
{
},
{
test
:
isAppComponents
,
test
:
isAppComponents
,
paths
:
appComponentsPaths
paths
:
appComponentsPaths
},
{
test
:
isCoreComponents
,
paths
:
coreComponentsPaths
},
{
},
{
test
:
isAppMixins
,
test
:
isAppMixins
,
paths
:
appMixinsPaths
paths
:
appMixinsPaths
...
@@ -159,7 +175,7 @@ function parseDeps(apis, manifest) {
...
@@ -159,7 +175,7 @@ function parseDeps(apis, manifest) {
})
})
if
(
strategy
)
{
if
(
strategy
)
{
strategy
.
paths
[
exports
]
=
filepath
strategy
.
paths
[
exports
]
=
filepath
}
else
{
}
else
{
console
.
log
(
'
dep
'
,
name
,
dep
)
console
.
log
(
'
dep
'
,
name
,
dep
)
console
.
warn
(
`
${
filepath
}
未识别`
)
console
.
warn
(
`
${
filepath
}
未识别`
)
}
}
...
@@ -175,6 +191,7 @@ function parseDeps(apis, manifest) {
...
@@ -175,6 +191,7 @@ function parseDeps(apis, manifest) {
apiProtocolPaths
,
apiProtocolPaths
,
invokeApiPaths
,
invokeApiPaths
,
appComponentsPaths
,
appComponentsPaths
,
coreComponentsPaths
,
appMixinsPaths
,
appMixinsPaths
,
systemRoutesPaths
,
systemRoutesPaths
,
apiSubscribePaths
apiSubscribePaths
...
@@ -203,6 +220,7 @@ module.exports = function updateApis(apis = new Set(), userApis = new Set()) {
...
@@ -203,6 +220,7 @@ module.exports = function updateApis(apis = new Set(), userApis = new Set()) {
invokeApiPaths
,
invokeApiPaths
,
apiSubscribePaths
,
apiSubscribePaths
,
appComponentsPaths
,
appComponentsPaths
,
coreComponentsPaths
,
appMixinsPaths
,
appMixinsPaths
,
systemRoutesPaths
systemRoutesPaths
}
=
parseDeps
(
apis
,
manifest
)
}
=
parseDeps
(
apis
,
manifest
)
...
@@ -214,6 +232,7 @@ module.exports = function updateApis(apis = new Set(), userApis = new Set()) {
...
@@ -214,6 +232,7 @@ module.exports = function updateApis(apis = new Set(), userApis = new Set()) {
updateInvokeApi
(
invokeApiPaths
)
updateInvokeApi
(
invokeApiPaths
)
updateAppComponents
(
appComponentsPaths
)
updateAppComponents
(
appComponentsPaths
)
updateCoreComponents
(
coreComponentsPaths
)
updateAppMixins
(
appMixinsPaths
)
updateAppMixins
(
appMixinsPaths
)
updateSystemRoutes
(
systemRoutesPaths
)
updateSystemRoutes
(
systemRoutesPaths
)
}
}
packages/vue-cli-plugin-uni-optimize/packages/webpack-optimize-plugin/component.js
浏览文件 @
96699f6a
...
@@ -37,12 +37,14 @@ module.exports = function updateComponents(tags) {
...
@@ -37,12 +37,14 @@ module.exports = function updateComponents(tags) {
tagName
=
capitalize
(
camelize
(
tagName
))
tagName
=
capitalize
(
camelize
(
tagName
))
return
`
${
tagName
}
.name = 'VUni
${
tagName
}
'
return
`
${
tagName
}
.name = 'VUni
${
tagName
}
'
${
tagName
}
.mixins =
${
tagName
}
.mixins ? [].concat(baseMixin,
${
tagName
}
.mixins) : [baseMixin]
${
tagName
}
.mixins =
${
tagName
}
.mixins ? [].concat(baseMixin,
${
tagName
}
.mixins) : [baseMixin]
${
tagName
}
.mixins.push(animation)
Vue.component(
${
tagName
}
.name,
${
tagName
}
)`
Vue.component(
${
tagName
}
.name,
${
tagName
}
)`
}).
join
(
'
\n
'
)
}).
join
(
'
\n
'
)
const
content
=
`
const
content
=
`
import Vue from 'vue'
import Vue from 'vue'
import baseMixin from 'uni-mixins/base'
import baseMixin from 'uni-mixins/base'
import animation from 'uni-mixins/animation'
${
importsStr
}
${
importsStr
}
${
componentsStr
}
${
componentsStr
}
`
`
...
...
packages/webpack-uni-mp-loader/lib/plugin/generate-json.js
浏览文件 @
96699f6a
...
@@ -91,6 +91,9 @@ module.exports = function generateJson (compilation) {
...
@@ -91,6 +91,9 @@ module.exports = function generateJson (compilation) {
const
jsonFileMap
=
getChangedJsonFileMap
()
const
jsonFileMap
=
getChangedJsonFileMap
()
for
(
let
name
of
jsonFileMap
.
keys
())
{
for
(
let
name
of
jsonFileMap
.
keys
())
{
const
jsonObj
=
JSON
.
parse
(
jsonFileMap
.
get
(
name
))
const
jsonObj
=
JSON
.
parse
(
jsonFileMap
.
get
(
name
))
if
(
process
.
env
.
UNI_PLATFORM
===
'
app-plus
'
)
{
// App平台默认增加usingComponents,激活__wxAppCode__
jsonObj
.
usingComponents
=
{}
}
// customUsingComponents
// customUsingComponents
if
(
jsonObj
.
customUsingComponents
&&
Object
.
keys
(
jsonObj
.
customUsingComponents
).
length
)
{
if
(
jsonObj
.
customUsingComponents
&&
Object
.
keys
(
jsonObj
.
customUsingComponents
).
length
)
{
jsonObj
.
usingComponents
=
Object
.
assign
(
jsonObj
.
customUsingComponents
,
jsonObj
.
usingComponents
)
jsonObj
.
usingComponents
=
Object
.
assign
(
jsonObj
.
customUsingComponents
,
jsonObj
.
usingComponents
)
...
...
src/core/service/api/context/create-map-context.js
浏览文件 @
96699f6a
import
{
import
{
invokeMethod
,
invokeMethod
,
getCurrentPageVm
getCurrentPageVm
}
from
'
../../platform
'
}
from
'
../../platform
'
import
{
callback
}
from
'
uni-shared
'
function
operateMapPlayer
(
mapId
,
pageVm
,
type
,
data
)
{
function
operateMapPlayer
(
mapId
,
pageVm
,
type
,
data
)
{
invokeMethod
(
'
operateMapPlayer
'
,
mapId
,
pageVm
,
type
,
data
)
invokeMethod
(
'
operateMapPlayer
'
,
mapId
,
pageVm
,
type
,
data
)
}
}
UniServiceJSBridge
.
subscribe
(
'
onMapMethodCallback
'
,
({
callbackId
,
data
})
=>
{
callback
.
invoke
(
callbackId
,
data
)
})
const
methods
=
[
'
getCenterLocation
'
,
'
translateMarker
'
,
'
getScale
'
,
'
getRegion
'
]
export
class
MapContext
{
export
class
MapContext
{
constructor
(
id
,
pageVm
)
{
constructor
(
id
,
pageVm
)
{
this
.
id
=
id
this
.
id
=
id
this
.
pageVm
=
pageVm
this
.
pageVm
=
pageVm
}
}
getCenterLocation
(
args
)
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getCenterLocation
'
,
args
)
}
moveToLocation
()
{
moveToLocation
()
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
moveToLocation
'
)
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
moveToLocation
'
)
}
}
translateMarker
(
args
)
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
translateMarker
'
,
args
)
}
includePoints
(
args
)
{
includePoints
(
args
)
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
includePoints
'
,
args
)
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
includePoints
'
,
args
)
}
}
}
getRegion
(
args
)
{
methods
.
forEach
(
function
(
method
)
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getRegion
'
,
args
)
MapContext
.
prototype
[
method
]
=
callback
.
warp
(
function
(
options
,
callbackId
)
{
}
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
method
,
{
options
,
getScale
(
args
)
{
callbackId
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getScale
'
,
args
)
}
)
}
}
)
}
}
)
export
function
createMapContext
(
id
,
context
)
{
export
function
createMapContext
(
id
,
context
)
{
if
(
context
)
{
if
(
context
)
{
...
...
src/core/view/components/swiper/index.vue
浏览文件 @
96699f6a
...
@@ -61,6 +61,10 @@ export default {
...
@@ -61,6 +61,10 @@ export default {
displayMultipleItems
:
{
displayMultipleItems
:
{
type
:
[
Number
,
String
],
type
:
[
Number
,
String
],
default
:
1
default
:
1
},
disableTouch
:
{
type
:
[
Boolean
,
String
],
default
:
false
}
}
},
},
data
()
{
data
()
{
...
@@ -538,6 +542,9 @@ export default {
...
@@ -538,6 +542,9 @@ export default {
}
}
},
},
_handleContentTrack
(
e
)
{
_handleContentTrack
(
e
)
{
if
(
this
.
disableTouch
)
{
return
}
if
(
!
this
.
_invalid
)
{
if
(
!
this
.
_invalid
)
{
if
(
e
.
detail
.
state
===
'
start
'
)
{
if
(
e
.
detail
.
state
===
'
start
'
)
{
this
.
userTracking
=
true
this
.
userTracking
=
true
...
...
src/platforms/app-plus/service/api/network/request.js
浏览文件 @
96699f6a
...
@@ -31,7 +31,7 @@ export function createRequestTaskById (requestTaskId, {
...
@@ -31,7 +31,7 @@ export function createRequestTaskById (requestTaskId, {
hasContentType
=
true
hasContentType
=
true
headers
[
'
Content-Type
'
]
=
header
[
name
]
headers
[
'
Content-Type
'
]
=
header
[
name
]
// TODO 需要重构
// TODO 需要重构
if
(
method
===
'
POST
'
&&
header
[
name
].
indexOf
(
'
application/x-www-form-urlencoded
'
)
===
0
)
{
if
(
method
!==
'
GET
'
&&
header
[
name
].
indexOf
(
'
application/x-www-form-urlencoded
'
)
===
0
&&
typeof
data
!==
'
string
'
&&
!
(
data
instanceof
ArrayBuffer
)
)
{
let
bodyArray
=
[]
let
bodyArray
=
[]
for
(
let
key
in
data
)
{
for
(
let
key
in
data
)
{
if
(
data
.
hasOwnProperty
(
key
))
{
if
(
data
.
hasOwnProperty
(
key
))
{
...
...
src/platforms/app-plus/view/components/map/index.vue
浏览文件 @
96699f6a
...
@@ -146,7 +146,9 @@ export default {
...
@@ -146,7 +146,9 @@ export default {
const
list
=
this
.
controls
.
map
((
control
)
=>
{
const
list
=
this
.
controls
.
map
((
control
)
=>
{
let
position
=
{
position
:
'
absolute
'
};
let
position
=
{
position
:
'
absolute
'
};
[
'
top
'
,
'
left
'
,
'
width
'
,
'
height
'
].
forEach
(
key
=>
{
[
'
top
'
,
'
left
'
,
'
width
'
,
'
height
'
].
forEach
(
key
=>
{
position
[
key
]
=
control
.
position
[
key
]
+
'
px
'
if
(
control
.
position
[
key
])
{
position
[
key
]
=
control
.
position
[
key
]
+
'
px
'
}
})
})
return
{
return
{
id
:
control
.
id
,
id
:
control
.
id
,
...
@@ -160,6 +162,25 @@ export default {
...
@@ -160,6 +162,25 @@ export default {
watch
:
{
watch
:
{
hidden
(
val
)
{
hidden
(
val
)
{
this
.
map
&&
this
.
map
[
val
?
'
hide
'
:
'
show
'
]()
this
.
map
&&
this
.
map
[
val
?
'
hide
'
:
'
show
'
]()
},
latitude
(
val
)
{
this
.
map
&&
this
.
map
.
setStyles
({
center
:
new
plus
.
maps
.
Point
(
this
.
longitude
,
this
.
latitude
)
})
},
longitude
(
val
)
{
this
.
map
&&
this
.
map
.
setStyles
({
center
:
new
plus
.
maps
.
Point
(
this
.
longitude
,
this
.
latitude
)
})
},
markers
(
val
)
{
this
.
map
&&
this
.
_addMarkers
(
val
)
},
polyline
(
val
)
{
this
.
map
&&
this
.
_addMapLines
(
val
)
},
circles
(
val
)
{
this
.
map
&&
this
.
_addMapCircles
(
val
)
}
}
},
},
mounted
()
{
mounted
()
{
...
@@ -175,17 +196,6 @@ export default {
...
@@ -175,17 +196,6 @@ export default {
if
(
this
.
hidden
)
{
if
(
this
.
hidden
)
{
map
.
hide
()
map
.
hide
()
}
}
this
.
$watch
(
'
attrs
'
,
()
=>
{
if
(
this
.
map
)
{
this
.
map
.
setStyles
(
this
.
attrs
)
// TODO 临时处理更新 longitude, latitude 无效问题
this
.
map
.
setStyles
({
center
:
new
plus
.
maps
.
Point
(
this
.
longitude
,
this
.
latitude
)
})
}
},
{
deep
:
true
})
this
.
$watch
(
'
position
'
,
()
=>
{
this
.
$watch
(
'
position
'
,
()
=>
{
this
.
map
&&
this
.
map
.
setStyles
(
this
.
position
)
this
.
map
&&
this
.
map
.
setStyles
(
this
.
position
)
},
{
},
{
...
@@ -214,13 +224,40 @@ export default {
...
@@ -214,13 +224,40 @@ export default {
}
}
this
.
map
&&
this
[
type
](
data
)
this
.
map
&&
this
[
type
](
data
)
},
},
getRegion
()
{
moveToLocation
(
data
)
{
this
.
map
.
setCenter
(
new
plus
.
maps
.
Point
(
this
.
longitude
,
this
.
latitude
))
},
getCenterLocation
({
callbackId
})
{
const
center
=
this
.
map
.
getCenter
()
this
.
_publishHandler
(
callbackId
,
{
longitude
:
center
.
longitude
,
latitude
:
center
.
latitude
,
errMsg
:
'
getCenterLocation:ok
'
})
},
},
getScale
()
{
getRegion
({
callbackId
})
{
const
rect
=
this
.
map
.
getBounds
()
this
.
_publishHandler
(
callbackId
,
{
southwest
:
rect
.
southwest
,
northeast
:
rect
.
northeast
||
rect
.
northease
,
// 5plus API 名字写错了
errMsg
:
'
getRegion:ok
'
})
},
getScale
({
callbackId
})
{
this
.
_publishHandler
(
callbackId
,
{
scale
:
this
.
map
.
getZoom
(),
errMsg
:
'
getScale:ok
'
})
},
},
controlclick
(
e
)
{
controlclick
(
e
)
{
this
.
$trigger
(
'
controltap
'
,
{},
{
id
:
e
.
id
})
this
.
$trigger
(
'
controltap
'
,
{},
{
id
:
e
.
id
})
},
},
_publishHandler
(
callbackId
,
data
)
{
UniViewJSBridge
.
publishHandler
(
'
onMapMethodCallback
'
,
{
callbackId
,
data
},
this
.
$page
.
id
)
},
_addMarker
(
nativeMap
,
marker
)
{
_addMarker
(
nativeMap
,
marker
)
{
const
{
const
{
id
,
id
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录