omiu - update icon, support path array
This commit is contained in:
parent
4a39fd4ee7
commit
419df39a26
|
@ -1,5 +1,6 @@
|
|||
import { WeElement, define, render } from 'omi'
|
||||
import '../../src/path-progress'
|
||||
import '../../src/icon'
|
||||
|
||||
//https://progressbarjs.readthedocs.io/en/latest/api/shape/
|
||||
const options = {
|
||||
|
@ -13,6 +14,13 @@ define('my-app', class extends WeElement {
|
|||
render() {
|
||||
return (
|
||||
<div>
|
||||
<o-icon paths={[{
|
||||
color: '#F98080',
|
||||
path: 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z'
|
||||
}, {
|
||||
color: '#F95050',
|
||||
path: 'M464 688a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z'
|
||||
}]}></o-icon>
|
||||
<o-path-progress
|
||||
type='Line' progress={0.5}
|
||||
text={'test'}
|
||||
|
|
|
@ -28,13 +28,21 @@ define('o-icon', class extends WeElement {
|
|||
fill={props.color}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path
|
||||
d={
|
||||
props.path
|
||||
? props.path
|
||||
: path[props.type][props.isFill ? 1 : 0] || path[props.type][0]
|
||||
}
|
||||
/>
|
||||
{props.paths ? (
|
||||
props.paths.map(item => {
|
||||
const attrs = { d: item.path }
|
||||
if (item.color) attrs.fill = item.color
|
||||
|
||||
return <path {...attrs}></path>
|
||||
})
|
||||
) : <path
|
||||
d={
|
||||
props.path
|
||||
? props.path
|
||||
: path[props.type][props.isFill ? 1 : 0] || path[props.type][0]
|
||||
}
|
||||
/>}
|
||||
|
||||
</svg>
|
||||
{props.children && (
|
||||
<div style={`color:${props.color || 'black'};`}>
|
||||
|
|
Loading…
Reference in New Issue