当前位置: 首页 > news >正文

网站开发测试工具各手机系统市场调研报告最佳范文

网站开发测试工具各手机系统,市场调研报告最佳范文,游戏网站的监管由谁来做,工行网站跟建设网站区别目录 一、安装 vite-plugin-svg-icons 二、创建图标文件夹 三、main.ts 引入注册脚本 四、vite.config.ts 插件配置 五、TypeScript支持 六、组件封装 七、使用 Element Plus 图标库往往满足不了实际开发需求,可以引用和使用第三方例如 iconfont 的图标&…

目录

一、安装 vite-plugin-svg-icons

二、创建图标文件夹

三、main.ts 引入注册脚本

四、vite.config.ts 插件配置

五、TypeScript支持

六、组件封装

七、使用


Element Plus 图标库往往满足不了实际开发需求,可以引用和使用第三方例如 iconfont 的图标,本节通过整合 vite-plugin-svg-icons 插件使用第三方图标库。

一、安装 vite-plugin-svg-icons

npm i fast-glob@3.2.11 -D
npm i vite-plugin-svg-icons@2.0.1 -D

二、创建图标文件夹

在src/assets文件夹下新建icons文件夹,用于存放下载的 SVG 图标

三、main.ts 引入注册脚本

// main.ts
import 'virtual:svg-icons-register';

四、vite.config.ts 插件配置

// vite.config.ts
import {UserConfig, ConfigEnv, loadEnv} from 'vite'
import vue from '@vitejs/plugin-vue'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';export default ({command, mode}: ConfigEnv): UserConfig => {// 获取 .env 环境配置文件const env = loadEnv(mode, process.cwd())return ({plugins: [vue(),createSvgIconsPlugin({// 指定需要缓存的图标文件夹iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],// 指定symbolId格式symbolId: 'icon-[dir]-[name]',})]})
}

五、TypeScript支持

// tsconfig.json
{"compilerOptions": {"types": ["vite-plugin-svg-icons/client"]}
}

六、组件封装

在src/components文件夹下新建SvgIcon文件夹,然后在SvgIcon文件夹下index.ts文件,内容如下:

<!--src/components/SvgIcon/index.vue-->
<template><svgaria-hidden="true"class="svg-icon":style="'width:' + size + ';height:' + size"><use :xlink:href="symbolId" :fill="color"/></svg>
</template><script setup lang="ts">
import {computed} from 'vue';const props = defineProps({prefix: {type: String,default: 'icon'},iconClass: {type: String,required: false},color: {type: String},size: {type: String,default: '1em'}
});const symbolId = computed(() => `#${props.prefix}-${props.iconClass}`);
</script><style scoped>
.svg-icon {overflow: hidden;fill: currentColor;
}
</style>

七、使用

<script setup lang="ts">
import SvgIcon from '@/components/SvgIcon/index.vue';
</script><template><svg-icon icon-class="wechat"/><svg-icon icon-class="menu"/>
</template>

http://www.hkea.cn/news/331725/

相关文章:

  • 北京建网站的公司哪个比较好郑州seo价格
  • 进空间的网站网络营销常见的工具
  • wordpress发文章的id怎么不连续如何做好搜索引擎优化工作
  • 交互式网站如何做seo推广软件排名
  • 西部建设网站惠州seo排名优化
  • 做环球资源网站有没有效果2024百度下载
  • 织梦 安装网站网站搭建需要多少钱
  • 做网站购买备案域名性价比高seo的排名优化
  • 潍坊中脉网站建设公司淄博seo公司
  • 深圳做网站推广哪家好青岛关键词优化平台
  • 呼和浩特市网站建设公司uc搜索引擎入口
  • 网站怎么做关键词搜索电子商务主要学什么内容
  • python做的网站漏洞百度竞价推广开户联系方式
  • 做任务换流量的网站怎么自己制作网页
  • 福清建设局网站火蝠电商代运营公司
  • 爱玖货源站在线智能识图
  • 上海网络营销软件windows优化大师win10
  • 专做美妆的视频网站ui设计
  • 平度市建设局网站济宁百度推广价格
  • 茶类网站建设方案西安网站seo排名优化
  • 南和县住房和建设局网站石家庄整站优化技术
  • 做教育网站销售的好吗成都百度网站排名优化
  • 展览展会网页模板下载河南网站优化排名
  • 自己做网站上传视频疫情二十条优化措施
  • 网站排名上升 优帮云网络销售培训学校
  • 对于政务网站建设的建议网站收录优化
  • 网站策划与建设阶段的推广方法网络软文怎么写
  • 漳州公司做网站重庆网站建设
  • 十大网络平台有哪些网站关键词排名seo
  • 建b2c网站google官方下载安装