Skip to content

Commit

Permalink
Add:
Browse files Browse the repository at this point in the history
    add code demo for label
  • Loading branch information
SleepyAries authored and zenjava committed Mar 18, 2020
1 parent 2743059 commit 6c2bc37
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 12 deletions.
32 changes: 21 additions & 11 deletions src/router/widgetrouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,20 @@ export default {
return import('../widgets/collapse');
},
},
'/component/label':
{
value: '/component/label',
sort: 76,
text: 'Label 文本',
exact: true,
render: async () => {
return import('../widgets/label');
},
},
'/component/popover':
{
value: '/component/popover',
sort: 76,
sort: 77,
text: 'Popover 气泡卡片',
exact: true,
render: async () => {
Expand All @@ -422,7 +432,7 @@ export default {
'/component/table':
{
value: '/component/table',
sort: 77,
sort: 78,
text: 'Table 表格',
exact: true,
render: async () => {
Expand All @@ -432,7 +442,7 @@ export default {
'/component/tabs':
{
value: '/component/tabs',
sort: 78,
sort: 79,
text: 'Tabs 标签页',
exact: true,
render: async () => {
Expand All @@ -442,7 +452,7 @@ export default {
'/component/tag':
{
value: '/component/tag',
sort: 79,
sort: 80,
text: 'Tag 标签',
exact: true,
render: async () => {
Expand All @@ -452,7 +462,7 @@ export default {
'/component/timeline':
{
value: '/component/timeline',
sort: 80,
sort: 81,
text: 'TimeLine 时间轴',
exact: true,
render: async () => {
Expand All @@ -462,7 +472,7 @@ export default {
'/component/tooltip':
{
value: '/component/tooltip',
sort: 81,
sort: 82,
text: 'Tooltip 文字提示',
exact: true,
render: async () => {
Expand All @@ -472,7 +482,7 @@ export default {
'/component/breadcrumb':
{
value: '/component/breadcrumb',
sort: 82,
sort: 83,
text: 'Breadcrumb 面包屑',
exact: true,
render: async () => {
Expand All @@ -482,7 +492,7 @@ export default {
'/component/button':
{
value: '/component/button',
sort: 83,
sort: 84,
text: 'Button 按钮',
exact: true,
render: async () => {
Expand All @@ -492,7 +502,7 @@ export default {
'/component/icon':
{
value: '/component/icon',
sort: 84,
sort: 85,
text: 'Icon 图标',
exact: true,
render: async () => {
Expand All @@ -502,7 +512,7 @@ export default {
'/component/grid':
{
value: '/component/grid',
sort: 85,
sort: 86,
text: 'Grid 栅格',
exact: true,
render: async () => {
Expand All @@ -512,7 +522,7 @@ export default {
'/component/layout':
{
value: '/component/layout',
sort: 86,
sort: 87,
text: 'Layout 布局',
exact: true,
render: async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/router/widgets.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions src/widgets/label/BasicLabel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react";
import { Label } from "@lugia/lugia-web";

export default class BasicLabel extends React.Component<any, any> {

render() {
return <React.Fragment>
<Label onClick={this.onClick}>这是一个文本组件</Label>
</React.Fragment>;
}
onClick = () => {
console.log('clickLabel');
}
}
12 changes: 12 additions & 0 deletions src/widgets/label/PrefixLabel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react";
import { Label } from "@lugia/lugia-web";

export default class PrefixLabel extends React.Component<any, any> {
render() {
return <React.Fragment>
<Label showPrefix prefix={'*'} >这是一个带前缀的文本组件</Label>
<br/><br/>
<Label showPrefix prefix={'##'} >这是一个带前缀的文本组件</Label>
</React.Fragment>;
}
}
54 changes: 54 additions & 0 deletions src/widgets/label/StyleLabel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React from "react";
import { Label ,Theme} from "@lugia/lugia-web";
import Widget from "@lugia/lugia-web/dist/consts";

export default class PrefixLabel extends React.Component<any, any> {
render() {
const config = {
[Widget.Label]: {
Container: {
normal: {
color: '#2d3c93',
font: {
weight: 'bold',
size: 20,
},
margin: {
left: 30,
top: 10,
},
padding: {
right: 10,
bottom: 10,
},
border: {
left:{
width:2,
style:'solid',
color:'#4d63ff'
}
},

},
hover: {
color: '#ac3400',
cursor: 'pointer',
},
},
LabelPrefix: {
normal: {
color: 'red',
margin: {
right: 10,
left: 5
},
},
},
},
};
return <Theme config={config}>
<Label showPrefix prefix={'*'} >这是一个带前缀的文本组件</Label>

</Theme>;
}
}
12 changes: 12 additions & 0 deletions src/widgets/label/TextLabel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react";
import { Label } from "@lugia/lugia-web";


export default class TextLabel extends React.Component<any, any> {

render() {
return <React.Fragment>
<Label text={'这是一个传入text属性的文本组件'}/>
</React.Fragment>;
}
}
18 changes: 18 additions & 0 deletions src/widgets/label/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
BasicLabel: {
title: "基础使用",
desc: "基础Label的用法"
},
TextLabel: {
title: "传入text属性",
desc: "传入text属性的用法"
},
PrefixLabel: {
title: "有前缀的文本组件",
desc: "有前缀的文本组件的用法"
},
StyleLabel: {
title: "文本组件主题配置",
desc: "可支持配置的文本组件样式"
}
};
Loading

0 comments on commit 6c2bc37

Please sign in to comment.