| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- const n = `<template>
- <component :is="name" :class="name" :style="{ fontSize: size + 'px', color: cor }" />
- </template>
- <script setup>
- import { ref, watch } from 'vue'
- const props = defineProps({
- // 图标名(antd 图标或内置业务图标)
- name: {
- type: String,
- required: true
- },
- // 图标尺寸,单位 px
- size: {
- type: Number,
- default: 16
- },
- // 图标颜色,默认继承文字颜色
- color: {
- type: String,
- default: ''
- }
- })
- const cor = ref('var(--s-color)')
- watch(
- () => props.color,
- (cr) => {
- cor.value = cr || 'var(--s-color)'
- },
- { immediate: true }
- )
- <\/script>
- <style lang="less" scoped>
- .icon-list {
- width: 100%;
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- flex-wrap: wrap;
- .item-icon {
- margin: 16px;
- cursor: pointer;
- font-size: 28px;
- }
- }
- </style>
- `;
- export {
- n as default
- };
|