|
@@ -3,6 +3,7 @@ import { computed, unref } from 'vue'
|
|
import { ElIcon } from 'element-plus'
|
|
import { ElIcon } from 'element-plus'
|
|
import { propTypes } from '@/utils/propTypes'
|
|
import { propTypes } from '@/utils/propTypes'
|
|
import { useDesign } from '@/hooks/web/useDesign'
|
|
import { useDesign } from '@/hooks/web/useDesign'
|
|
|
|
+import { Icon } from '@iconify/vue'
|
|
|
|
|
|
const { getPrefixCls } = useDesign()
|
|
const { getPrefixCls } = useDesign()
|
|
|
|
|
|
@@ -24,6 +25,11 @@ const symbolId = computed(() => {
|
|
return unref(isLocal) ? `#icon-${props.icon.split('svg-icon:')[1]}` : props.icon
|
|
return unref(isLocal) ? `#icon-${props.icon.split('svg-icon:')[1]}` : props.icon
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+// 是否使用在线图标
|
|
|
|
+const isUseOnline = computed(() => {
|
|
|
|
+ return import.meta.env.VITE_USE_ONLINE_ICON === 'true'
|
|
|
|
+})
|
|
|
|
+
|
|
const getIconifyStyle = computed(() => {
|
|
const getIconifyStyle = computed(() => {
|
|
const { color, size } = props
|
|
const { color, size } = props
|
|
return {
|
|
return {
|
|
@@ -39,15 +45,18 @@ const getIconifyStyle = computed(() => {
|
|
<use :xlink:href="symbolId" />
|
|
<use :xlink:href="symbolId" />
|
|
</svg>
|
|
</svg>
|
|
|
|
|
|
- <!-- <Icon v-else :icon="icon" :style="getIconifyStyle" /> -->
|
|
|
|
- <div :class="`${icon} iconify`" :style="getIconifyStyle"></div>
|
|
|
|
|
|
+ <template v-else>
|
|
|
|
+ <Icon v-if="isUseOnline" :icon="icon" :style="getIconifyStyle" />
|
|
|
|
+ <div v-else :class="`${icon} iconify`" :style="getIconifyStyle"></div>
|
|
|
|
+ </template>
|
|
</ElIcon>
|
|
</ElIcon>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
@prefix-cls: ~'@{namespace}-icon';
|
|
@prefix-cls: ~'@{namespace}-icon';
|
|
|
|
|
|
-.@{prefix-cls} {
|
|
|
|
|
|
+.@{prefix-cls},
|
|
|
|
+.iconify {
|
|
:deep(svg) {
|
|
:deep(svg) {
|
|
&:hover {
|
|
&:hover {
|
|
// stylelint-disable-next-line
|
|
// stylelint-disable-next-line
|