国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁 > news >正文

建網(wǎng)站的公司大全開創(chuàng)集團與百度

建網(wǎng)站的公司大全,開創(chuàng)集團與百度,項目經(jīng)理證書怎么考,網(wǎng)站開發(fā)與管理課程因為我們要根據(jù)路由配置對應(yīng)的圖標(biāo),也要為了后續(xù)方便更改。因此我們將所有的圖標(biāo)注冊為全局組件。(使用之前將分頁器以及矢量圖注冊全局組件的自定義插件)(所有圖標(biāo)全局注冊的方法element-plus文檔中已給出) 全局注冊…

因為我們要根據(jù)路由配置對應(yīng)的圖標(biāo),也要為了后續(xù)方便更改。因此我們將所有的圖標(biāo)注冊為全局組件。(使用之前將分頁器以及矢量圖注冊全局組件的自定義插件)(所有圖標(biāo)全局注冊的方法element-plus文檔中已給出)

全局注冊elementPlus圖標(biāo)

在這里插入圖片描述
經(jīng)過上面的步驟,就可以把elementPlus自帶的icon圖標(biāo)全局注冊了。

路由使用elementPlus圖標(biāo)

給路由元信息添加屬性:icon
layout和其子組件為例:首先在element-puls找到你要使用的圖標(biāo)的名字。將它添加到路由元信息的icon屬性上

{//登錄成功以后展示數(shù)據(jù)的路由path: '/',component: () => import('@/layout/index.vue'),name: 'layout',meta: {title: 'layout',hidden: false,icon: 'Avatar',//elementPlus中的圖標(biāo)},children: [{path: '/home',component: () => import('@/views/home/index.vue'),meta: {title: '首頁',hidden: false,icon: 'HomeFilled',//elementPlus中的圖標(biāo)},},],
},

外部引入的svg圖標(biāo)——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圖標(biāo)的使用,例如全屏圖標(biāo):

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

順道寫下全屏功能的實現(xiàn):

<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])})},
}

結(jié)合文章中第一步的全局引入elementPlus圖標(biāo),也可以放在此文件中:
完整代碼如下:

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 的圖標(biāo)注冊為全局組件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://aloenet.com.cn/news/30168.html

相關(guān)文章:

  • 深圳微網(wǎng)站建設(shè)今日油價92汽油
  • 婚戀網(wǎng)站系統(tǒng)人工智能培訓(xùn)機構(gòu)排名前十
  • 天津?qū)I(yè)網(wǎng)站制作流程優(yōu)勢網(wǎng)站搜索關(guān)鍵詞優(yōu)化
  • 西安高校網(wǎng)站建設(shè)搜索網(wǎng)站有哪些
  • 瀑布流網(wǎng)站史上最強大的搜索神器
  • 空間制作網(wǎng)站頭條收錄提交入口
  • 1.網(wǎng)站開發(fā)的詳細(xì)流程網(wǎng)站優(yōu)化靠譜seo
  • 網(wǎng)站建設(shè)接單吧大數(shù)據(jù)營銷經(jīng)典案例
  • 公安部門網(wǎng)站建設(shè)方案百度一下百度
  • 小影wordpress主題廈門seo排名公司
  • 外貿(mào)網(wǎng)站響應(yīng)式百度推廣代理怎么加盟
  • 仿網(wǎng)站源碼相親網(wǎng)站排名前十名
  • 網(wǎng)站制作服務(wù)價格今天的重要新聞
  • 做淘寶客網(wǎng)站要注意什么免費建站免費推廣的網(wǎng)站
  • 個人建立網(wǎng)站后怎么盈利百度最新收錄方法
  • 淳安縣千島湖建設(shè)集團網(wǎng)站市場調(diào)研報告800字
  • 購物網(wǎng)站創(chuàng)建網(wǎng)址導(dǎo)航大全
  • php網(wǎng)站開發(fā)要學(xué)什么軟件培訓(xùn)學(xué)校招生方案范文
  • 網(wǎng)站建設(shè)所操作是什么怎樣做企業(yè)推廣
  • wordpress 獲取文章時間seo優(yōu)化培訓(xùn)機構(gòu)
  • 私活接單平臺windows優(yōu)化大師的優(yōu)點
  • 鄧州網(wǎng)站建設(shè)免費廣告推廣
  • h5響應(yīng)式企業(yè)網(wǎng)站源碼百度推廣客戶端下載
  • 創(chuàng)可貼網(wǎng)站怎么做圖片大全北京網(wǎng)站優(yōu)化
  • 佛山網(wǎng)站優(yōu)化公司做百度推廣代運營有用嗎
  • 包裝在線設(shè)計網(wǎng)站谷歌seo靠譜嗎
  • 哈爾濱網(wǎng)站開發(fā)培訓(xùn)seo推廣代運營
  • 王者榮耀網(wǎng)站建設(shè)的步驟怎么弄一個自己的網(wǎng)站
  • 上海做公益活動有哪些好的網(wǎng)站黑帽seo是什么意思
  • 公司網(wǎng)站域名做郵箱自己做網(wǎng)站設(shè)計制作