Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uview-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李晖
uview-ui
Commits
103a881b
Commit
103a881b
authored
Oct 13, 2020
by
yiruiwen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'yiruiwen'
parents
b2bf9e0a
e3c5744e
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
71 additions
and
267 deletions
+71
-267
en.js
common/locales/en.js
+1
-1
index.vue
pages/componentsA/avatar/index.vue
+1
-1
index.vue
pages/componentsA/form/index.vue
+1
-1
index.vue
pages/componentsA/tabs/index.vue
+13
-6
index.vue
pages/componentsC/test/index.vue
+2
-239
index.vue
pages/template/order/index.vue
+2
-1
u-avatar.vue
uview-ui/components/u-avatar/u-avatar.vue
+1
-0
u-dropdown-item.vue
uview-ui/components/u-dropdown-item/u-dropdown-item.vue
+1
-1
u-image.vue
uview-ui/components/u-image/u-image.vue
+10
-6
u-loadmore.vue
uview-ui/components/u-loadmore/u-loadmore.vue
+1
-1
u-message-input.vue
uview-ui/components/u-message-input/u-message-input.vue
+1
-1
u-read-more.vue
uview-ui/components/u-read-more/u-read-more.vue
+1
-1
u-tabs-swiper.vue
uview-ui/components/u-tabs-swiper/u-tabs-swiper.vue
+17
-4
u-tabs.vue
uview-ui/components/u-tabs/u-tabs.vue
+19
-4
No files found.
common/locales/en.js
View file @
103a881b
...
...
@@ -10,7 +10,7 @@ export default {
desc
:
'
Collection of many commonly used pages and layouts, reducing the repetitive work of developers, allowing you to focus on logic and get twice the result with half the effort
'
},
nav
:
{
components
:
'
Comonents
'
,
components
:
'
Com
p
onents
'
,
js
:
'
JS
'
,
template
:
'
Template
'
},
...
...
pages/componentsA/avatar/index.vue
View file @
103a881b
...
...
@@ -6,7 +6,7 @@
<u-avatar
:mode=
"mode"
:size=
"size"
:src=
"
''
"
:src=
"
src
"
:text=
"text"
:showLevel=
"showLevel"
:showSex=
"showSex"
...
...
pages/componentsA/form/index.vue
View file @
103a881b
...
...
@@ -402,7 +402,7 @@ export default {
}
},
labelPositionChange
(
index
)
{
this
.
labelPosition
=
index
==
0
?
'
left
'
:
'
right
'
;
this
.
labelPosition
=
index
==
0
?
'
left
'
:
'
top
'
;
},
codeChange
(
text
)
{
this
.
codeTips
=
text
;
...
...
pages/componentsA/tabs/index.vue
View file @
103a881b
...
...
@@ -4,8 +4,8 @@
<view
class=
"u-demo-title"
>
演示效果
</view>
<view
class=
"u-demo-area"
>
<u-toast
ref=
"uToast"
></u-toast>
<u-tabs
v-if=
"control"
bg-color=
"#fafafa"
:bold=
"bold"
:active-color=
"activeColor"
:list=
"list"
@
change=
"change"
:current=
"current"
:is-scroll=
"isScroll"
></u-tabs>
<u-tabs
v-if=
"control"
bg-color=
"#fafafa"
:bold=
"bold"
:active-color=
"activeColor"
:list=
"list"
@
change=
"change"
:current=
"current"
:is-scroll=
"isScroll"
:offset=
"offset"
></u-tabs>
</view>
</view>
<view
class=
"u-config-wrap"
>
...
...
@@ -38,9 +38,11 @@
return
{
list
:
[],
data
:
[{
name
:
'
关注
'
name
:
'
关注
'
,
count
:
100
},
{
name
:
'
推荐
'
name
:
'
推荐
'
,
count
:
7
},
{
name
:
'
电影
'
},{
...
...
@@ -62,7 +64,8 @@
tabCountIndex
:
0
,
activeColor
:
this
.
$u
.
color
[
'
primary
'
],
bold
:
true
,
control
:
true
control
:
true
,
offset
:
[
5
,
-
5
]
}
},
onLoad
()
{
...
...
@@ -75,17 +78,20 @@
this
.
list
=
[];
this
.
list
.
push
(
this
.
data
[
0
]);
this
.
list
.
push
(
this
.
data
[
1
]);
this
.
offset
=
[
5
,
60
]
}
else
if
(
index
==
1
)
{
this
.
list
=
[];
this
.
list
.
push
(
this
.
data
[
0
]);
this
.
list
.
push
(
this
.
data
[
1
]);
this
.
list
.
push
(
this
.
data
[
2
]);
this
.
offset
=
[
5
,
20
]
}
else
{
this
.
list
=
[];
this
.
list
.
push
(
this
.
data
[
0
]);
this
.
list
.
push
(
this
.
data
[
1
]);
this
.
list
.
push
(
this
.
data
[
2
]);
this
.
list
.
push
(
this
.
data
[
3
]);
this
.
offset
=
[
5
,
5
]
}
this
.
tabCountIndex
=
index
;
this
.
isScroll
=
false
;
...
...
@@ -99,6 +105,7 @@
if
(
index
==
0
)
{
this
.
isScroll
=
true
;
this
.
list
=
this
.
data
;
this
.
offset
=
[
5
,
-
5
]
}
else
{
this
.
isScroll
=
false
;
this
.
countChange
(
this
.
tabCountIndex
);
...
...
@@ -135,6 +142,6 @@
<
style
lang=
"scss"
scoped
>
.u-config-wrap
{
}
</
style
>
pages/componentsC/test/index.vue
View file @
103a881b
<
template
>
<view
class=
"wrap"
>
<u-waterfall
v-model=
"flowList"
ref=
"uWaterfall"
>
<template
v-slot:left=
"
{ leftList }">
<view
class=
"demo-warter"
v-for=
"(item, index) in leftList"
:key=
"index"
>
<view
class=
""
@
tap=
"click1(item)"
>
<!-- 警告:微信小程序不支持嵌入lazyload组件,请自行如下使用image标签 -->
<!-- #ifndef MP-WEIXIN -->
<u-lazy-load
threshold=
"-450"
border-radius=
"10"
:image=
"item.image"
:index=
"index"
></u-lazy-load>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view
class=
"demo-img-wrap"
><image
class=
"demo-image"
:src=
"item.image"
mode=
"widthFix"
></image></view>
<!-- #endif -->
<view
class=
"demo-title"
>
{{
item
.
title
}}
</view>
<view
class=
"demo-price"
>
{{
item
.
price
}}
元
</view>
<view
class=
"demo-tag"
>
<view
class=
"demo-tag-owner"
>
自营
</view>
<view
class=
"demo-tag-text"
>
放心购
</view>
</view>
<view
class=
"demo-shop"
>
{{
item
.
shop
}}
</view>
<!-- 微信小程序无效,因为它不支持在template中引入组件 -->
<view
class=
"u-close"
>
<u-icon
name=
"close-circle-fill"
color=
"#fa3534"
size=
"34"
@
click=
"remove(item.id)"
></u-icon>
</view>
</view>
</view>
</
template
>
<
template
v-slot:right=
"{ rightList }"
>
<view
class=
"demo-warter"
v-for=
"(item, index) in rightList"
:key=
"index"
>
<!-- #ifndef MP-WEIXIN -->
<u-lazy-load
threshold=
"-450"
border-radius=
"10"
:image=
"item.image"
:index=
"index"
></u-lazy-load>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view
class=
"demo-img-wrap"
><image
class=
"demo-image"
:src=
"item.image"
mode=
"widthFix"
></image></view>
<!-- #endif -->
<view
class=
"demo-title"
>
{{
item
.
title
}}
</view>
<view
class=
"demo-price"
>
{{
item
.
price
}}
元
</view>
<view
class=
"demo-tag"
>
<view
class=
"demo-tag-owner"
>
自营
</view>
<view
class=
"demo-tag-text"
>
放心购
</view>
</view>
<view
class=
"demo-shop"
>
{{
item
.
shop
}}
</view>
<!-- 微信小程序无效,因为它不支持在template中引入组件 -->
<view
class=
"u-close"
>
<u-icon
name=
"close-circle-fill"
color=
"#fa3534"
size=
"34"
@
click=
"remove(item.id)"
></u-icon>
</view>
</view>
</
template
>
</u-waterfall>
<u-loadmore
bg-color=
"rgb(240, 240, 240)"
:status=
"loadStatus"
@
loadmore=
"addRandomData"
></u-loadmore>
</view>
</template>
<
script
>
export
default
{
data
()
{
return
{
loadStatus
:
'
loadmore
'
,
flowList
:
[],
list
:
[
{
price
:
35
,
title
:
'
北国风光,千里冰封,万里雪飘
'
,
shop
:
'
李白杜甫白居易旗舰店
'
,
image
:
'
http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23327_s.jpg
'
},
{
price
:
75
,
title
:
'
望长城内外,惟余莽莽
'
,
shop
:
'
李白杜甫白居易旗舰店
'
,
image
:
'
http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23325_s.jpg
'
},
{
price
:
385
,
title
:
'
大河上下,顿失滔滔
'
,
shop
:
'
李白杜甫白居易旗舰店
'
,
image
:
'
http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg
'
},
{
price
:
784
,
title
:
'
欲与天公试比高
'
,
shop
:
'
李白杜甫白居易旗舰店
'
,
image
:
'
http://pic2.sc.chinaz.com/Files/pic/pic9/202002/zzpic23369_s.jpg
'
},
{
price
:
7891
,
title
:
'
须晴日,看红装素裹,分外妖娆
'
,
shop
:
'
李白杜甫白居易旗舰店
'
,
image
:
'
http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2130_s.jpg
'
},
{
price
:
2341
,
shop
:
'
李白杜甫白居易旗舰店
'
,
title
:
'
江山如此多娇,引无数英雄竞折腰
'
,
image
:
'
http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23346_s.jpg
'
},
{
price
:
661
,
shop
:
'
李白杜甫白居易旗舰店
'
,
title
:
'
惜秦皇汉武,略输文采
'
,
image
:
'
http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23344_s.jpg
'
},
{
price
:
1654
,
title
:
'
唐宗宋祖,稍逊风骚
'
,
shop
:
'
李白杜甫白居易旗舰店
'
,
image
:
'
http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg
'
},
{
price
:
1678
,
title
:
'
一代天骄,成吉思汗
'
,
shop
:
'
李白杜甫白居易旗舰店
'
,
image
:
'
http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg
'
},
{
price
:
924
,
title
:
'
只识弯弓射大雕
'
,
shop
:
'
李白杜甫白居易旗舰店
'
,
image
:
'
http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg
'
},
{
price
:
8243
,
title
:
'
俱往矣,数风流人物,还看今朝
'
,
shop
:
'
李白杜甫白居易旗舰店
'
,
image
:
'
http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg
'
}
]
};
},
onLoad
()
{
this
.
addRandomData
();
},
onReachBottom
()
{
this
.
loadStatus
=
'
loading
'
;
// 模拟数据加载
setTimeout
(()
=>
{
this
.
addRandomData
();
this
.
loadStatus
=
'
loadmore
'
;
},
1000
);
},
methods
:
{
addRandomData
()
{
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
let
index
=
this
.
$u
.
random
(
0
,
this
.
list
.
length
-
1
);
// 先转成字符串再转成对象,避免数组对象引用导致数据混乱
let
item
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
list
[
index
]));
item
.
id
=
this
.
$u
.
guid
();
this
.
flowList
.
push
(
item
);
}
},
remove
(
id
)
{
this
.
$refs
.
uWaterfall
.
remove
(
id
);
},
clear
()
{
this
.
$refs
.
uWaterfall
.
clear
();
},
click1
(
item
){
console
.
log
(
item
);
}
}
};
</
script
>
<
style
>
/* page不能写带scope的style标签中,否则无效 */
page
{
background-color
:
rgb
(
240
,
240
,
240
);
}
</
style
>
<
style
lang=
"scss"
scoped
>
.demo-warter
{
border-radius
:
8px
;
margin
:
5px
;
background-color
:
#ffffff
;
padding
:
8px
;
position
:
relative
;
}
.u-close
{
position
:
absolute
;
top
:
32rpx
;
right
:
32rpx
;
}
.demo-img-wrap
{
}
.demo-image
{
width
:
100%
;
border-radius
:
4px
;
}
.demo-title
{
font-size
:
30rpx
;
margin-top
:
5px
;
color
:
$u-main-color
;
}
.demo-tag
{
display
:
flex
;
margin-top
:
5px
;
}
.demo-tag-owner
{
background-color
:
$u-type-error
;
color
:
#ffffff
;
display
:
flex
;
align-items
:
center
;
padding
:
4rpx
14rpx
;
border-radius
:
50rpx
;
font-size
:
20rpx
;
line-height
:
1
;
}
.demo-tag-text
{
border
:
1px
solid
$u-type-primary
;
color
:
$u-type-primary
;
margin-left
:
10px
;
border-radius
:
50rpx
;
line-height
:
1
;
padding
:
4rpx
14rpx
;
display
:
flex
;
align-items
:
center
;
border-radius
:
50rpx
;
font-size
:
20rpx
;
}
.demo-price
{
font-size
:
30rpx
;
color
:
$u-type-error
;
margin-top
:
5px
;
}
.demo-shop
{
font-size
:
22rpx
;
color
:
$u-tips-color
;
margin-top
:
5px
;
}
</
style
>
<view></view>
</
template
>
\ No newline at end of file
pages/template/order/index.vue
View file @
103a881b
...
...
@@ -278,7 +278,8 @@ export default {
name
:
'
待收货
'
},
{
name
:
'
待评价
'
name
:
'
待评价
'
,
count
:
12
}
],
current
:
0
,
...
...
uview-ui/components/u-avatar/u-avatar.vue
View file @
103a881b
...
...
@@ -124,6 +124,7 @@
// 用户可能会在头像加载失败时,再次修改头像值,所以需要重新赋值
if
(
!
n
)
{
// 如果传入null或者'',或者undefined,显示默认头像
this
.
avatar
=
base64Avatar
;
this
.
error
=
true
;
}
else
{
this
.
avatar
=
n
;
...
...
uview-ui/components/u-dropdown-item/u-dropdown-item.vue
View file @
103a881b
...
...
@@ -11,7 +11,7 @@
color: value == item.value ? activeColor : inactiveColor
}">
<u-icon
v-if=
"value == item.value"
name=
"checkbox-mark"
:color=
"activeColor"
size=
"32"
></u-icon>
</u-cell-item>
</u-cell-item>
;
</u-cell-group>
</view>
</scroll-view>
...
...
uview-ui/components/u-image/u-image.vue
View file @
103a881b
...
...
@@ -162,12 +162,16 @@ export default {
};
},
watch
:
{
src
(
n
)
{
if
(
!
n
)
{
// 如果传入null或者'',或者false,或者undefined,标记为错误状态
this
.
isError
=
true
;
}
else
{
this
.
isError
=
false
;
src
:
{
immediate
:
true
,
handler
(
n
)
{
if
(
!
n
)
{
// 如果传入null或者'',或者false,或者undefined,标记为错误状态
this
.
isError
=
true
;
this
.
loading
=
false
;
}
else
{
this
.
isError
=
false
;
}
}
}
},
...
...
uview-ui/components/u-loadmore/u-loadmore.vue
View file @
103a881b
...
...
@@ -41,7 +41,7 @@
export
default
{
name
:
"
u-loadmore
"
,
props
:
{
//
当前页面背景颜色,如果背景为非白色的时候,需要把此值设置为背景的颜
色
//
组件背景
色
bgColor
:
{
type
:
String
,
default
:
'
transparent
'
...
...
uview-ui/components/u-message-input/u-message-input.vue
View file @
103a881b
...
...
@@ -11,7 +11,7 @@
width: width + 'rpx',
height: width + 'rpx',
color: inactiveColor,
borderColor: charArrLength === index
&&
mode == 'box' ? activeColor :
'none'
borderColor: charArrLength === index
&&
mode == 'box' ? activeColor :
inactiveColor
}">
<view
class=
"u-placeholder-line"
:style=
"
{
display: charArrLength === index ? 'block' : 'none',
...
...
uview-ui/components/u-read-more/u-read-more.vue
View file @
103a881b
...
...
@@ -2,7 +2,7 @@
<view
class=
""
>
<view
class=
"u-content"
:class=
"[elId]"
:style=
"
{
height: isLongContent
&&
!showMore ? showHeight + 'rpx' : 'auto',
textIndent: t
his.t
extIndent
textIndent: textIndent
}">
<slot></slot>
</view>
...
...
uview-ui/components/u-tabs-swiper/u-tabs-swiper.vue
View file @
103a881b
...
...
@@ -7,6 +7,7 @@
<view
class=
"u-tabs-scroll-box"
:class=
"
{'u-tabs-scorll-flex': !isScroll}">
<view
class=
"u-tabs-item"
:style=
"[tabItemStyle(index)]"
v-for=
"(item, index) in getTabs"
:key=
"index"
:class=
"[preId + index]"
@
tap=
"emit(index)"
>
<u-badge
:count=
"item[count] || item['count'] || 0"
:offset=
"offset"
size=
"mini"
></u-badge>
{{
item
[
name
]
||
item
[
'
name
'
]
}}
</view>
<view
v-if=
"showBar"
class=
"u-scroll-bar"
:style=
"[tabBarStyle]"
></view>
...
...
@@ -18,9 +19,7 @@
<
script
>
import
colorGradient
from
'
../../libs/function/colorGradient
'
;
let
color
=
colorGradient
;
const
{
windowWidth
}
=
uni
.
getSystemInfoSync
();
const
{
windowWidth
}
=
uni
.
getSystemInfoSync
();
const
preId
=
'
UEl_
'
;
/**
...
...
@@ -43,6 +42,8 @@
* @property {String Number} gutter 单个tab标签的左右内边距之和,单位rpx(默认40)
* @property {String} bg-color tabs导航栏的背景颜色(默认#ffffff)
* @property {String} name 组件内部读取的list参数中的属性名,见官网说明(默认name)
* @property {String} count 组件内部读取的list参数中的属性名(badge徽标数),同name属性的使用,见官网说明(默认count)
* @property {Array} offset 设置badge徽标数的位置偏移,格式为 [x, y],也即设置的为top和right的值,单位rpx(默认[5, 20])
* @property {Boolean} bold 激活选项的字体是否加粗(默认true)
* @event {Function} change 点击标签时触发
* @example <u-tabs-swiper ref="tabs" :list="list" :is-scroll="false"></u-tabs-swiper>
...
...
@@ -127,11 +128,23 @@
type
:
String
,
default
:
'
window
'
},
// 读取传入的数组对象的属性
// 读取传入的数组对象的属性
(tab名称)
name
:
{
type
:
String
,
default
:
'
name
'
},
// 读取传入的数组对象的属性(徽标数)
count
:
{
type
:
String
,
default
:
'
count
'
},
// 徽标数位置偏移
offset
:
{
type
:
Array
,
default
:
()
=>
{
return
[
5
,
20
]
}
},
// 活动tab字体是否加粗
bold
:
{
type
:
Boolean
,
...
...
uview-ui/components/u-tabs/u-tabs.vue
View file @
103a881b
...
...
@@ -8,6 +8,7 @@
<view
class=
"u-scroll-box"
:class=
"
{'u-tabs-scorll-flex': !isScroll}">
<view
class=
"u-tab-item u-line-1"
:id=
"'u-tab-item-' + index"
v-for=
"(item, index) in list"
:key=
"index"
@
tap=
"clickTab(index)"
:style=
"[tabItemStyle(index)]"
>
<u-badge
:count=
"item[count] || item['count'] || 0"
:offset=
"offset"
size=
"mini"
></u-badge>
{{
item
[
name
]
||
item
[
'
name
'
]
}}
</view>
<view
v-if=
"showBar"
class=
"u-tab-bar"
:style=
"[tabBarStyle]"
></view>
...
...
@@ -20,7 +21,7 @@
<
script
>
/**
* tabs 标签
* @description 该组件,是一个tabs标签组件,在标签多的时候,可以配置为左右滑动,标签少的时候,可以禁止滑动。 该组件的一个特点是配置为滚动模式时,激活的tab会自动移动到组件的中间位置。
* @description 该组件,是一个tabs标签组件,在标签多的时候,可以配置为左右滑动,标签少的时候,可以禁止滑动。 该组件的一个特点是配置为滚动模式时,激活的tab会自动移动到组件的中间位置。
* @tutorial https://www.uviewui.com/components/tabs.html
* @property {Boolean} is-scroll tabs是否可以左右拖动(默认true)
* @property {Array} list 标签数组,元素为对象,如[{name: '推荐'}]
...
...
@@ -38,7 +39,9 @@
* @property {String Number} item-width 标签的宽度(默认auto)
* @property {String Number} gutter 单个tab标签的左右内边距之和,单位rpx(默认40)
* @property {String} bg-color tabs导航栏的背景颜色(默认#ffffff)
* @property {String} name 组件内部读取的list参数中的属性名,见官网说明(默认name)
* @property {String} name 组件内部读取的list参数中的属性名(tab名称),见官网说明(默认name)
* @property {String} count 组件内部读取的list参数中的属性名(badge徽标数),同name属性的使用,见官网说明(默认count)
* @property {Array} offset 设置badge徽标数的位置偏移,格式为 [x, y],也即设置的为top和right的值,单位rpx(默认[5, 20])
* @property {Boolean} bold 激活选项的字体是否加粗(默认true)
* @event {Function} change 点击标签时触发
* @example <u-tabs ref="tabs" :list="list" :is-scroll="false"></u-tabs>
...
...
@@ -108,11 +111,23 @@
type
:
String
,
default
:
'
#ffffff
'
},
// 读取传入的数组对象的属性
// 读取传入的数组对象的属性
(tab名称)
name
:
{
type
:
String
,
default
:
'
name
'
},
// 读取传入的数组对象的属性(徽标数)
count
:
{
type
:
String
,
default
:
'
count
'
},
// 徽标数位置偏移
offset
:
{
type
:
Array
,
default
:
()
=>
{
return
[
5
,
20
]
}
},
// 活动tab字体是否加粗
bold
:
{
type
:
Boolean
,
...
...
@@ -290,7 +305,7 @@
<
style
lang=
"scss"
scoped
>
@import
"../../libs/css/style.components.scss"
;
view
,
scroll-view
{
box-sizing
:
border-box
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment