Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CoderSmallfan
uni-app
提交
0774f384
U
uni-app
项目概览
CoderSmallfan
/
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,发现更多精彩内容 >>
提交
0774f384
编写于
10月 30, 2018
作者:
hbcui1984
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hello uni-app 新增 tag标签 模板
上级
0bd510b1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
271 addition
and
0 deletion
+271
-0
examples/hello-uniapp/components/uni-tag.vue
examples/hello-uniapp/components/uni-tag.vue
+132
-0
examples/hello-uniapp/pages/template/tag/tag.vue
examples/hello-uniapp/pages/template/tag/tag.vue
+139
-0
未找到文件。
examples/hello-uniapp/components/uni-tag.vue
0 → 100644
浏览文件 @
0774f384
<
template
>
<view
class=
"uni-tag"
v-if=
"text"
:class=
"[disabled === true || disabled === 'true' ? 'uni-tag-disabled' : '',inverted === true || inverted === 'true' ? 'uni-tag-inverted' : '',circle === true || circle === 'true' ? 'uni-tag-circle' : '','uni-tag-'+size,'uni-tag-'+type]"
@
click=
"onClick()"
>
{{
text
}}
</view>
</
template
>
<
script
>
export
default
{
props
:
{
type
:
{
//标签类型default、primary、success、warning、danger、royal
type
:
String
,
default
:
'
default
'
},
size
:
{
//标签大小 normal, small
type
:
String
,
default
:
'
normal
'
},
text
:
String
,
//标签内容
disabled
:
{
//是否为禁用状态
type
:
[
String
,
Boolean
],
defalut
:
false
},
inverted
:
{
//是否为空心
type
:
[
String
,
Boolean
],
defalut
:
false
},
circle
:
{
//是否为圆角
type
:
[
String
,
Boolean
],
defalut
:
false
}
},
methods
:
{
onClick
()
{
if
(
this
.
disabled
===
true
||
this
.
disabled
===
'
true
'
){
return
;
}
this
.
$emit
(
'
click
'
)
}
}
}
</
script
>
<
style
>
.uni-tag
,
.uni-tag-default
{
box-sizing
:
border-box
;
padding
:
0px
32
upx
;
height
:
60
upx
;
line-height
:
calc
(
60
upx
-
2px
);
font-size
:
28
upx
;
display
:
inline-block
;
color
:
#666
;
border-radius
:
8
upx
;
background-color
:
#F1F1F1
;
border
:
1px
solid
#F1F1F1
;
}
.uni-tag-circle
{
border-radius
:
30
upx
;
}
.uni-tag-small
{
height
:
40
upx
;
padding
:
0px
16
upx
;
line-height
:
calc
(
40
upx
-
2px
);
font-size
:
20
rpx
;
}
.uni-tag-disabled
{
opacity
:
0.5
;
}
.uni-tag.uni-tag-inverted
{
color
:
#666
;
background-color
:
#FFFFFF
;
border
:
1px
solid
#
F1F1F1
;
}
.uni-tag-primary
{
color
:
#fff
;
background-color
:
#007aff
;
border
:
1px
solid
#007aff
;
}
.uni-tag-primary.uni-tag-inverted
{
color
:
#007aff
;
background-color
:
#FFFFFF
;
border
:
1px
solid
#007aff
;
}
.uni-tag-success
{
color
:
#fff
;
background-color
:
#4cd964
;
border
:
1px
solid
#4cd964
;
}
.uni-tag-success.uni-tag-inverted
{
color
:
#4cd964
;
background-color
:
#FFFFFF
;
border
:
1px
solid
#4cd964
;
}
.uni-tag-warning
{
color
:
#fff
;
background-color
:
#f0ad4e
;
border
:
1px
solid
#f0ad4e
;
}
.uni-tag-warning.uni-tag-inverted
{
color
:
#f0ad4e
;
background-color
:
#FFFFFF
;
border
:
1px
solid
#f0ad4e
;
}
.uni-tag-danger
{
color
:
#fff
;
background-color
:
#dd524d
;
border
:
1px
solid
#dd524d
;
}
.uni-tag-danger.uni-tag-inverted
{
color
:
#dd524d
;
background-color
:
#FFFFFF
;
border
:
1px
solid
#dd524d
;
}
.uni-tag-royal
{
color
:
#fff
;
background-color
:
#8a6de9
;
border
:
1px
solid
#8a6de9
;
}
.uni-tag-royal.uni-tag-inverted
{
color
:
#8a6de9
;
background-color
:
#FFFFFF
;
border
:
1px
solid
#8a6de9
;
}
</
style
>
examples/hello-uniapp/pages/template/tag/tag.vue
0 → 100644
浏览文件 @
0774f384
<
template
>
<view
class=
"page"
>
<page-head
:title=
"title"
></page-head>
<view
class=
"page-body"
>
<view
class=
"page-section"
>
<view
class=
"page-section-title"
>
实心标签
</view>
<view
class=
"page-section"
>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
type=
"primary"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
type=
"success"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
type=
"warning"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
type=
"danger"
:circle=
"true"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
type=
"royal"
:circle=
"true"
></uni-tag>
</view>
</view>
</view>
<view
class=
"page-section"
>
<view
class=
"page-section-title"
>
空心标签
</view>
<view
class=
"page-section"
>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
inverted=
"true"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
inverted=
"true"
type=
"primary"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
inverted=
"true"
type=
"success"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
inverted=
"true"
type=
"warning"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
inverted=
"true"
type=
"danger"
:circle=
"true"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
inverted=
"true"
type=
"royal"
:circle=
"true"
></uni-tag>
</view>
</view>
</view>
<view
class=
"page-section"
>
<view
class=
"page-section-title"
>
点击事件
</view>
<view
class=
"page-section"
>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
:type=
"type"
@
click=
"setType"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
type=
"primary"
:circle=
"true"
:inverted=
"inverted"
@
click=
"setInverted"
></uni-tag>
</view>
</view>
</view>
<view
class=
"page-section"
>
<view
class=
"page-section-title"
>
小标签
</view>
<view
class=
"page-section"
>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
size=
"small"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
type=
"primary"
size=
"small"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
type=
"success"
size=
"small"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
inverted=
"true"
type=
"warning"
size=
"small"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
inverted=
"true"
type=
"danger"
size=
"small"
:circle=
"true"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
inverted=
"true"
type=
"royal"
size=
"small"
:circle=
"true"
></uni-tag>
</view>
</view>
</view>
<view
class=
"page-section"
>
<view
class=
"page-section-title"
>
不可点击状态
</view>
<view
class=
"page-section"
>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
:disabled=
"true"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
type=
"primary"
:disabled=
"true"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
inverted=
"true"
type=
"danger"
size=
"small"
:disabled=
"true"
></uni-tag>
</view>
<view
class=
"tag-view"
>
<uni-tag
text=
"标签"
inverted=
"true"
type=
"royal"
size=
"small"
:circle=
"true"
:disabled=
"true"
></uni-tag>
</view>
</view>
</view>
</view>
</view>
</
template
>
<
script
>
import
uniTag
from
'
@/components/uni-tag.vue
'
export
default
{
components
:
{
uniTag
},
data
()
{
return
{
title
:
'
tag
'
,
type
:
'
default
'
,
inverted
:
false
}
},
methods
:
{
setType
()
{
let
types
=
[
'
default
'
,
'
primary
'
,
'
success
'
,
'
warning
'
,
'
danger
'
,
'
royal
'
];
let
index
=
types
.
indexOf
(
this
.
type
);
types
.
splice
(
index
,
1
)
let
randomIndex
=
Math
.
ceil
(
Math
.
random
()
*
5
);
this
.
type
=
types
[
randomIndex
];
},
setInverted
()
{
this
.
inverted
=
!
this
.
inverted
;
}
}
}
</
script
>
<
style
>
.tag-view
{
margin
:
10
upx
20
upx
;
display
:
inline-block
;
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录