-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
zhangbing4
committed
Sep 26, 2024
1 parent
e68d342
commit 705df9d
Showing
13 changed files
with
201 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: 支持Icon | ||
order: 3 | ||
--- | ||
|
||
标签类型:`default`, `primary`, `success`, `warning` `danger` | ||
|
||
```vdt | ||
import {Tip, Icon} from 'kpc'; | ||
<div> | ||
<Tip v-for={this.get('types')} | ||
type={$value} | ||
showIcon | ||
closable | ||
>{$value}</Tip> | ||
<Tip type="success" showIcon closable> | ||
这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容。 | ||
</Tip> | ||
<h3>自定义Icon</h3> | ||
<Tip> | ||
<b:icon><Icon class="k-icon-internet" /></b:icon> | ||
custom Icon | ||
</Tip> | ||
<h3>标题带Icon</h3> | ||
<Tip type="primary" showIcon> | ||
<b:title>这是标题</b:title> | ||
This is a tip. | ||
</Tip> | ||
<h3>标题自定义Icon</h3> | ||
<Tip type="primary" showIcon closable> | ||
<b:icon><Icon class="k-icon-internet" /></b:icon> | ||
<b:title>这是标题</b:title> | ||
This is a tip. | ||
</Tip> | ||
</div> | ||
``` | ||
|
||
```styl | ||
.k-tip | ||
margin-bottom 8px | ||
``` | ||
|
||
```ts | ||
export default class extends Component { | ||
static template = template; | ||
static defaults() { | ||
return { | ||
types: ['default', 'primary', 'success', 'warning', 'danger'] as const | ||
}; | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,31 @@ | ||
import {TypeDefs} from 'intact'; | ||
import template from './index.vdt'; | ||
import {Tag, TagProps, TagEvents, TagBlocks} from '../tag/base'; | ||
|
||
export interface TipProps extends TagProps { } | ||
export interface TipProps extends TagProps { | ||
showIcon?: boolean | ||
} | ||
|
||
export interface TipEvents extends TagEvents { } | ||
|
||
export interface TipBlocks extends TagBlocks { | ||
title: null | ||
close: null | ||
icon: null | ||
} | ||
|
||
const typeDefs: Required<TypeDefs<TipProps>> = { | ||
...Tag.typeDefs, | ||
showIcon: Boolean, | ||
}; | ||
|
||
const defaults = (): Partial<TipProps> => ({ | ||
...Tag.defaults(), | ||
showIcon: false, | ||
}); | ||
|
||
export class Tip extends Tag<TipProps, TipEvents, TipBlocks> { | ||
static template = template; | ||
static typeDefs = typeDefs; | ||
static defaults = defaults; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.