mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-06 03:57:49 +08:00
RayIcon组件调整
This commit is contained in:
parent
3eda36374e
commit
646066b918
@ -1,5 +1,16 @@
|
|||||||
.ray-icon {
|
.ray-icon {
|
||||||
|
width: var(--ray-icon-width);
|
||||||
|
height: var(--ray-icon-height);
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
@include flexCenter;
|
text-align: center;
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
fill: currentColor;
|
||||||
|
transform: translateZ(0);
|
||||||
|
|
||||||
|
& svg[rayIconAttribute="ray-icon"] {
|
||||||
|
width: var(--ray-icon-width);
|
||||||
|
height: var(--ray-icon-height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ const RayIcon = defineComponent({
|
|||||||
props: {
|
props: {
|
||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: 'currentColor',
|
||||||
},
|
},
|
||||||
prefix: {
|
prefix: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -46,25 +46,32 @@ const RayIcon = defineComponent({
|
|||||||
setup(props) {
|
setup(props) {
|
||||||
const modelColor = computed(() => props.color)
|
const modelColor = computed(() => props.color)
|
||||||
const symbolId = computed(() => `#${props.prefix}-${props.name}`)
|
const symbolId = computed(() => `#${props.prefix}-${props.name}`)
|
||||||
|
const cssVars = computed(() => {
|
||||||
|
const cssVar = {
|
||||||
|
'--ray-icon-width': props.width
|
||||||
|
? props.width + 'px'
|
||||||
|
: props.size + 'px',
|
||||||
|
'--ray-icon-height': props.width
|
||||||
|
? props.height + 'px'
|
||||||
|
: props.size + 'px',
|
||||||
|
}
|
||||||
|
|
||||||
|
return cssVar
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
modelColor,
|
modelColor,
|
||||||
symbolId,
|
symbolId,
|
||||||
|
cssVars,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div class={`ray-icon ${this.customClassName}`}>
|
<span class={['ray-icon', this.customClassName]} style={[this.cssVars]}>
|
||||||
<svg
|
<svg rayIconAttribute="ray-icon" ariaHidden={true}>
|
||||||
ariaHidden={true}
|
|
||||||
style={{
|
|
||||||
width: `${this.width ? this.width : this.size}px`,
|
|
||||||
height: `${this.height ? this.height : this.size}px`,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<use xlink:href={this.symbolId} fill={this.modelColor} />
|
<use xlink:href={this.symbolId} fill={this.modelColor} />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</span>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -43,7 +43,7 @@ const RayLink = defineComponent({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'ray-template-doc-out',
|
key: 'ray-template-doc-out',
|
||||||
src: 'https://ray.yunkuangao.com/ray-template-doc/',
|
src: 'https://ray-template.yunkuangao.com/',
|
||||||
tooltip: 'Ray Template Doc (国内地址)',
|
tooltip: 'Ray Template Doc (国内地址)',
|
||||||
icon: 'https://yunkuangao.com/images/longmao.jpeg',
|
icon: 'https://yunkuangao.com/images/longmao.jpeg',
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user