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

上海大型网站建设论坛推广的特点

上海大型网站建设,论坛推广的特点,网站规划与网页设计总结,国外网站空间租用哪个好因为我们要根据路由配置对应的图标,也要为了后续方便更改。因此我们将所有的图标注册为全局组件。(使用之前将分页器以及矢量图注册全局组件的自定义插件)(所有图标全局注册的方法element-plus文档中已给出) 全局注册…

因为我们要根据路由配置对应的图标,也要为了后续方便更改。因此我们将所有的图标注册为全局组件。(使用之前将分页器以及矢量图注册全局组件的自定义插件)(所有图标全局注册的方法element-plus文档中已给出)

全局注册elementPlus图标

在这里插入图片描述
经过上面的步骤,就可以把elementPlus自带的icon图标全局注册了。

路由使用elementPlus图标

给路由元信息添加属性:icon
layout和其子组件为例:首先在element-puls找到你要使用的图标的名字。将它添加到路由元信息的icon属性上

{//登录成功以后展示数据的路由path: '/',component: () => import('@/layout/index.vue'),name: 'layout',meta: {title: 'layout',hidden: false,icon: 'Avatar',//elementPlus中的图标},children: [{path: '/home',component: () => import('@/views/home/index.vue'),meta: {title: '首页',hidden: false,icon: 'HomeFilled',//elementPlus中的图标},},],
},

外部引入的svg图标——vite.config.js中批量引入

在这里插入图片描述

import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
export default defineConfig(({command,mode})=>{const env = loadEnv(mode,process.cwd())return {plugins:[vue(),AutoImport({resolvers: [ElementPlusResolver(),IconsResolver({prefix: 'Icon',}),],}),Components({resolvers: [ElementPlusResolver(),IconsResolver({enabledCollections: ['ep'],}),],}),Icons({autoInstall: true,}),createSvgIconsPlugin({// Specify the icon folder to be cachediconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],// Specify symbolId formatsymbolId: 'icon-[dir]-[name]',}),]}
})

然后svg图标的使用,例如全屏图标:

<el-button icon="FullScreen" circle @click="fullScreen" />

顺道写下全屏功能的实现:

<script lang="ts" setup>
import {reactive,ref} from 'vue';
//全屏功能
const fullScreen = ()=>{//用来判断是不是全屏,返回布尔值const full = document.fullscreenElement//有兼容问题if(full){document.exitFullscreen();}else{document.documentElement.requestFullscreen();}
}
</script>

在这里插入图片描述

components中的组件全局批量注册——避免使用时多次引入

在这里插入图片描述

步骤一:在components文件夹中新建index.ts文件

步骤二:在index.ts文件中引入各个组件

import SvgIcon from './SvgIcon/index.vue'
import Category from '@/components/Category/index.vue'

步骤三:使用vue中的AppComponent

import type { App, Component } from 'vue'
const allGlobalComponent: Component = { SvgIcon, Category }

步骤四:使用install方法来处理

export default {install(app: App) {Object.keys(allGlobalComponent).forEach((key: string) => {// 注册为全局组件app.component(key, allGlobalComponent[key])})},
}

结合文章中第一步的全局引入elementPlus图标,也可以放在此文件中:
完整代码如下:

import SvgIcon from './SvgIcon/index.vue'
import Category from '@/components/Category/index.vue'
import type { App, Component } from 'vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
const allGlobalComponent: Component = { SvgIcon, Category }
export default {install(app: App) {Object.keys(allGlobalComponent).forEach((key: string) => {// 注册为全局组件app.component(key, allGlobalComponent[key])})// 将 element-plus 的图标注册为全局组件for (const [key, component] of Object.entries(ElementPlusIconsVue)) {app.component(key, component)}},
}

main.ts中引入components

import globalComponent from './components/index'
const app = createApp(App)
app.use(globalComponent)
http://www.mmbaike.com/news/98963.html

相关文章:

  • 宝鸡企业网站制作正规代运营公司排名
  • 怎么用网站做word文件格式整站优化快速排名
  • 上海大型网站建设公司爱站seo查询软件
  • 微信做一元云购网站推广运营公司哪家好
  • 备案中心查网站百度收录查询方法
  • wordpress源码东莞市网络seo推广价格
  • 设计高端的国外网站网站页面seo
  • 移动互联网论文5000字快速排名优化推广手机
  • 如何做国外的网站网络营销方案模板
  • 做安装系统网站有钱赚吗seo教程百度网盘
  • 建设部网站证书查询网络营销专业是干什么的
  • 怎么键卖东西的网站seo优化中以下说法正确的是
  • 网上效果代码网站可以下载吗360竞价推广登录入口
  • 南山区住房与建设局官方网站新媒体运营培训班
  • django完整网站开发推广文案怎么写
  • wordpress 图片并排seo服务外包
  • 哪个网站做图片外链百度在线客服系统
  • 网站icp备案查不到百度推广联系人
  • 网站功能模块报价seo优化是怎么回事呢
  • 公司创建网站要多少钱杭州网站设计公司
  • go网站开发百度大搜数据多少钱一条
  • 网站服务公司案例网络营销推广方案ppt
  • 开封网站开发新闻头条今日要闻10条
  • 连云港建设厅官方网站seo自动工具
  • 网易网站建设的目的qq群引流推广平台
  • 网站建设合作流程图优化网站软文
  • 网站建设web前端开发入门如何做好网络推广
  • 四川建设集团有限公司网站市场营销比较好写的论文题目
  • 网站设计如何在ps先做免费源码资源源码站
  • 湖北专业网站建设口碑好电商网站有哪些