Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
e55d8d97
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
717
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e55d8d97
编写于
8月 05, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
上级
8a9b4d95
a8827859
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
118 addition
and
43 deletion
+118
-43
docs/api/ui/tabbar.md
docs/api/ui/tabbar.md
+10
-9
packages/uni-template-compiler/__tests__/compiler-mp-toutiao.spec.js
...i-template-compiler/__tests__/compiler-mp-toutiao.spec.js
+20
-13
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
...ni-template-compiler/__tests__/compiler-mp-weixin.spec.js
+7
-0
packages/uni-template-compiler/lib/constants.js
packages/uni-template-compiler/lib/constants.js
+1
-0
packages/uni-template-compiler/lib/template/traverse.js
packages/uni-template-compiler/lib/template/traverse.js
+17
-2
packages/webpack-uni-mp-loader/lib/plugin/generate-app.js
packages/webpack-uni-mp-loader/lib/plugin/generate-app.js
+16
-10
src/core/helpers/protocol/ui/tab-bar.js
src/core/helpers/protocol/ui/tab-bar.js
+3
-0
src/core/view/components/editor/index.vue
src/core/view/components/editor/index.vue
+2
-3
src/platforms/app-plus/service/api/ui/tab-bar.js
src/platforms/app-plus/service/api/ui/tab-bar.js
+12
-5
src/platforms/h5/service/api/ui/tab-bar.js
src/platforms/h5/service/api/ui/tab-bar.js
+14
-1
src/platforms/mp-alipay/runtime/wrapper/component-parser.js
src/platforms/mp-alipay/runtime/wrapper/component-parser.js
+8
-0
src/platforms/mp-alipay/runtime/wrapper/page-parser.js
src/platforms/mp-alipay/runtime/wrapper/page-parser.js
+8
-0
未找到文件。
docs/api/ui/tabbar.md
浏览文件 @
e55d8d97
...
...
@@ -10,15 +10,16 @@
**OBJECT参数说明:**
|属性|类型|默认值|必填|说明|
|:-|:-|:-|:-|:-|
|index|number||是|tabBar 的哪一项,从左边算起|
|text|String||否|tab 上的按钮文字|
|iconPath|String||否|图片路径,icon 大小限制为 40kb,建议尺寸为 81px
*
81px,当 postion 为 top 时,此参数无效,不支持网络图片|
|selectedIconPath|String||否|选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px
*
81px ,当 postion 为 top 时,此参数无效|
|success|Funtion||否|接口调用成功的回调函数|
|fail|Funtion||否|接口调用失败的回调函数|
|complete|Funtion||否|接口调用结束的回调函数(调用成功、失败都会执行)|
|属性|类型|默认值|必填|说明|平台差异|
|:-|:-|:-|:-|:-|:-|
|index|number||是|tabBar 的哪一项,从左边算起||
|text|String||否|tab 上的按钮文字||
|iconPath|String||否|图片路径,icon 大小限制为 40kb,建议尺寸为 81px
*
81px,当 postion 为 top 时,此参数无效,不支持网络图片||
|selectedIconPath|String||否|选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px
*
81px ,当 postion 为 top 时,此参数无效||
|pagePath|String||否|页面绝对路径,必须在
[
pages
](
/collocation/pages?id=pages
)
中先定义|App(2.8.4+)、H5(2.8.4+)|
|success|Funtion||否|接口调用成功的回调函数||
|fail|Funtion||否|接口调用失败的回调函数||
|complete|Funtion||否|接口调用结束的回调函数(调用成功、失败都会执行)||
**示例代码**
...
...
packages/uni-template-compiler/__tests__/compiler-mp-toutiao.spec.js
浏览文件 @
e55d8d97
...
...
@@ -72,4 +72,11 @@ describe('mp:compiler-mp-toutiao', () => {
'
<view class="{{((
\'
bg _p
\'
)+
\'
\'
+(classStr1||classStr2))}}">9</view>
'
)
})
it
(
'
generate v-show directive
'
,
()
=>
{
assertCodegen
(
'
<test v-show="shown">hello world</test>
'
,
'
<test bind:-data-custom-hidden="{{!(shown)}}" vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}">hello world</test>
'
)
})
})
packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js
浏览文件 @
e55d8d97
...
...
@@ -132,4 +132,11 @@ describe('mp:compiler-mp-weixin', () => {
)
assertCodegen
(
'
<test :obj="{x:0}"></test>
'
,
'
<test vue-id="551070e6-1" obj="{{({x:0})}}" bind:__l="__l"></test>
'
)
})
it
(
'
generate v-show directive
'
,
()
=>
{
assertCodegen
(
'
<test v-show="shown">hello world</test>
'
,
'
<test data-custom-hidden="{{!(shown)}}" vue-id="551070e6-1" bind:__l="__l" vue-slots="{{[
\'
default
\'
]}}">hello world</test>
'
)
})
})
packages/uni-template-compiler/lib/constants.js
浏览文件 @
e55d8d97
...
...
@@ -63,6 +63,7 @@ module.exports = {
ATTR_DATA_EVENT_OPTS
:
'
data-event-opts
'
,
ATTR_DATA_COM_TYPE
:
'
data-com-type
'
,
ATTR_DATA_EVENT_PARAMS
:
'
data-event-params
'
,
ATTE_DATA_CUSTOM_HIDDEN
:
'
data-custom-hidden
'
,
INTERNAL_GET_ORIG
,
INTERNAL_GET_CLASS
,
INTERNAL_GET_STYLE
,
...
...
packages/uni-template-compiler/lib/template/traverse.js
浏览文件 @
e55d8d97
...
...
@@ -9,9 +9,14 @@ const {
genCode
,
getCode
,
getForKey
,
traverseKey
traverseKey
,
isComponent
}
=
require
(
'
../util
'
)
const
{
ATTE_DATA_CUSTOM_HIDDEN
}
=
require
(
'
../constants
'
)
module
.
exports
=
function
traverse
(
ast
,
state
=
{})
{
babelTraverse
(
ast
,
{
WithStatement
(
path
)
{
...
...
@@ -222,7 +227,17 @@ function traverseDataNode (dataNode, state, node) {
objectExpression
.
properties
.
find
(
valueProperty
=>
{
const
isValue
=
valueProperty
.
key
.
name
===
'
value
'
if
(
isValue
)
{
ret
.
hidden
=
genCode
(
valueProperty
.
value
,
false
,
true
)
let
key
// 自定义组件不支持 hidden 属性
const
platform
=
state
.
options
.
platform
.
name
const
platforms
=
[
'
mp-weixin
'
,
'
mp-qq
'
,
'
mp-toutiao
'
]
if
(
isComponent
(
node
.
type
)
&&
platforms
.
includes
(
platform
))
{
// 字节跳动小程序自定义属性不会反应在DOM上,只能使用事件格式
key
=
`
${
platform
===
'
mp-toutiao
'
?
'
bind:-
'
:
''
}${
ATTE_DATA_CUSTOM_HIDDEN
}
`
}
else
{
key
=
'
hidden
'
}
ret
[
key
]
=
genCode
(
valueProperty
.
value
,
false
,
true
)
}
return
isValue
})
...
...
packages/webpack-uni-mp-loader/lib/plugin/generate-app.js
浏览文件 @
e55d8d97
...
...
@@ -45,6 +45,11 @@ module.exports = function generateApp (compilation) {
}
}
// 框架预设样式 用于隐藏自定义组件
// TODO 分平台 import 不同 css
const
platforms
=
[
'
mp-weixin
'
,
'
mp-qq
'
,
'
mp-toutiao
'
]
const
presetStyle
=
platforms
.
includes
(
process
.
env
.
UNI_PLATFORM
)
?
'
[data-custom-hidden="true"],[bind-data-custom-hidden="true"]{display: none !important;}
'
:
''
if
(
compilation
.
assets
[
`common/main
${
ext
}
`
])
{
// 是否存在 main.css
importMainCss
=
`@import './common/main
${
ext
}
';`
}
...
...
@@ -90,6 +95,7 @@ require('./common/main.js')`
},
{
file
:
'
app
'
+
ext
,
source
:
`
${
importMainCss
}
${
importVendorCss
}
`
${
importVendorCss
}
${
presetStyle
}
`
}]
}
src/core/helpers/protocol/ui/tab-bar.js
浏览文件 @
e55d8d97
...
...
@@ -18,6 +18,9 @@ export const setTabBarItem = {
},
selectedIconPath
:
{
type
:
String
},
pagePath
:
{
type
:
String
}
}
...
...
src/core/view/components/editor/index.vue
浏览文件 @
e55d8d97
...
...
@@ -281,9 +281,8 @@ export default {
if
(
this
.
skipMatcher
)
{
return
delta
}
return
{
ops
:
delta
.
ops
.
filter
(({
insert
})
=>
typeof
insert
===
'
string
'
).
map
(({
insert
})
=>
({
insert
}))
}
delta
.
ops
=
delta
.
ops
.
filter
(({
insert
})
=>
typeof
insert
===
'
string
'
).
map
(({
insert
})
=>
({
insert
}))
return
delta
})
this
.
initKeyboard
(
$el
)
this
.
quillReady
=
true
...
...
src/platforms/app-plus/service/api/ui/tab-bar.js
浏览文件 @
e55d8d97
...
...
@@ -19,14 +19,21 @@ export function setTabBarItem ({
index
,
text
,
iconPath
,
selectedIconPath
selectedIconPath
,
pagePath
})
{
if
(
!
isTabBarPage
())
{
return
{
errMsg
:
'
setTabBarItem:fail not TabBar page
'
tabBar
.
setTabBarItem
(
index
,
text
,
iconPath
,
selectedIconPath
)
const
route
=
pagePath
&&
__uniRoutes
.
find
(({
path
})
=>
path
===
pagePath
)
if
(
route
)
{
const
meta
=
route
.
meta
meta
.
isTabBar
=
true
meta
.
tabBarIndex
=
index
meta
.
isQuit
=
true
const
tabBar
=
__uniConfig
.
tabBar
if
(
tabBar
&&
tabBar
.
list
&&
tabBar
.
list
[
index
])
{
tabBar
.
list
[
index
].
pagePath
=
pagePath
.
startsWith
(
'
/
'
)
?
pagePath
.
substring
(
1
)
:
pagePath
}
}
tabBar
.
setTabBarItem
(
index
,
text
,
iconPath
,
selectedIconPath
)
return
{
errMsg
:
'
setTabBarItem:ok
'
}
...
...
src/platforms/h5/service/api/ui/tab-bar.js
浏览文件 @
e55d8d97
...
...
@@ -43,9 +43,22 @@ function setTabBar (type, args = {}) {
case
'
hideTabBar
'
:
app
.
$children
[
0
].
hideTabBar
=
true
break
case
'
setTabBarItem
'
:
case
'
setTabBarItem
'
:
{
setProperties
(
tabBar
.
list
[
index
],
setTabBarItemProps
,
args
)
const
pagePath
=
args
.
pagePath
const
route
=
pagePath
&&
__uniRoutes
.
find
(({
path
})
=>
path
===
pagePath
)
if
(
route
)
{
const
meta
=
route
.
meta
meta
.
isTabBar
=
true
meta
.
tabBarIndex
=
index
meta
.
isQuit
=
true
const
tabBar
=
__uniConfig
.
tabBar
if
(
tabBar
&&
tabBar
.
list
&&
tabBar
.
list
[
index
])
{
tabBar
.
list
[
index
].
pagePath
=
pagePath
.
startsWith
(
'
/
'
)
?
pagePath
.
substring
(
1
)
:
pagePath
}
}
break
}
case
'
setTabBarStyle
'
:
setProperties
(
tabBar
,
setTabBarStyleProps
,
args
)
break
...
...
src/platforms/mp-alipay/runtime/wrapper/component-parser.js
浏览文件 @
e55d8d97
...
...
@@ -128,5 +128,13 @@ export default function parseComponent (vueComponentOptions) {
componentOptions
.
didUpdate
=
createObserver
(
true
)
}
if
(
Array
.
isArray
(
vueOptions
.
wxsCallMethods
))
{
vueOptions
.
wxsCallMethods
.
forEach
(
callMethod
=>
{
componentOptions
.
methods
[
callMethod
]
=
function
(
args
)
{
return
this
.
$vm
[
callMethod
](
args
)
}
})
}
return
componentOptions
}
src/platforms/mp-alipay/runtime/wrapper/page-parser.js
浏览文件 @
e55d8d97
...
...
@@ -78,5 +78,13 @@ export default function parsePage (vuePageOptions) {
initHooks
(
pageOptions
,
hooks
,
vuePageOptions
)
if
(
Array
.
isArray
(
vueOptions
.
wxsCallMethods
))
{
vueOptions
.
wxsCallMethods
.
forEach
(
callMethod
=>
{
pageOptions
[
callMethod
]
=
function
(
args
)
{
return
this
.
$vm
[
callMethod
](
args
)
}
})
}
return
pageOptions
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录