最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue 圖標(biāo)選擇器的實例代碼

 更新時間:2021年11月12日 17:06:12   作者:閏土的土  
本文通過實例代碼給大家介紹了vue 圖標(biāo)選擇器的相關(guān)知識,圖文實例代碼相結(jié)合給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友參考下吧

來源:http://www.ruoyi.vip/

import Vue from 'vue'
import SvgIcon from '@/components/SvgIcon'// svg component
 
// register globally
Vue.component('svg-icon', SvgIcon)
 
const req = require.context('./svg', false, /\.svg$/)
const requireAll = requireContext => requireContext.keys().map(requireContext)
requireAll(req)

  

# replace default config
 
# multipass: true
# full: true
 
plugins:
 
  # - name
  #
  # or:
  # - name: false
  # - name: true
  #
  # or:
  # - name:
  #     param1: 1
  #     param2: 2
 
- removeAttrs:
    attrs:
      - 'fill'
      - 'fill-rule'

  

<template>
  <div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" />
  <svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners">
    <use :xlink:href="iconName" rel="external nofollow"  />
  </svg>
</template>
 
<script>
// doc: https://panjiachen.github.io/vue-element-admin-site/feature/component/svg-icon.html#usage
import { isExternal } from '@/utils/validate'
 
export default {
  name: 'SvgIcon',
  props: {
    iconClass: {
      type: String,
      required: true
    },
    className: {
      type: String,
      default: ''
    }
  },
  computed: {
    isExternal() {
      return isExternal(this.iconClass)
    },
    iconName() {
      return `#icon-${this.iconClass}`
    },
    svgClass() {
      if (this.className) {
        return 'svg-icon ' + this.className
      } else {
        return 'svg-icon'
      }
    },
    styleExternalIcon() {
      return {
        mask: `url(${this.iconClass}) no-repeat 50% 50%`,
        '-webkit-mask': `url(${this.iconClass}) no-repeat 50% 50%`
      }
    }
  }
}
</script>
 
<style scoped>
.svg-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
 
.svg-external-icon {
  background-color: currentColor;
  mask-size: cover!important;
  display: inline-block;
}
</style>

  

<!-- @author zhengjie -->
<template>
  <div class="icon-body">
    <el-input v-model="name" style="position: relative;" clearable placeholder="請輸入圖標(biāo)名稱" @clear="filterIcons" @input.native="filterIcons">
      <i slot="suffix" class="el-icon-search el-input__icon" />
    </el-input>
    <div class="icon-list">
      <div v-for="(item, index) in iconList" :key="index" @click="selectedIcon(item)">
        <svg-icon :icon-class="item" style="height: 30px;width: 16px;" />
        <span>{{ item }}</span>
      </div>
    </div>
  </div>
</template>
 
<script>
import icons from './requireIcons'
export default {
  name: 'IconSelect',
  data() {
    return {
      name: '',
      iconList: icons
    }
  },
  methods: {
    filterIcons() {
      this.iconList = icons
      if (this.name) {
        this.iconList = this.iconList.filter(item => item.includes(this.name))
      }
    },
    selectedIcon(name) {
      this.$emit('selected', name)
      document.body.click()
    },
    reset() {
      this.name = ''
      this.iconList = icons
    }
  }
}
</script>
 
<style rel="stylesheet/scss" lang="scss" scoped>
  .icon-body {
    width: 100%;
    padding: 10px;
    .icon-list {
      height: 200px;
      overflow-y: scroll;
      div {
        height: 30px;
        line-height: 30px;
        margin-bottom: -5px;
        cursor: pointer;
        width: 33%;
        float: left;
      }
      span {
        display: inline-block;
        vertical-align: -0.15em;
        fill: currentColor;
        overflow: hidden;
      }
    }
  }
</style>

  

到此這篇關(guān)于vue 圖標(biāo)選擇器的文章就介紹到這了,更多相關(guān)vue 選擇器內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 使用idea創(chuàng)建第一個Vue項目

    使用idea創(chuàng)建第一個Vue項目

    最近在學(xué)習(xí)vue,本文主要介紹了使用idea創(chuàng)建第一個Vue項目,文中根據(jù)圖文介紹的十分詳盡,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-03-03
  • vue-cli創(chuàng)建vue項目的詳細(xì)步驟記錄

    vue-cli創(chuàng)建vue項目的詳細(xì)步驟記錄

    vue.cli是vue中的項目構(gòu)造工具,是一個npm包,需要安裝node.js和 git才能用,下面這篇文章主要給大家介紹了關(guān)于利用vue-cli創(chuàng)建vue項目的詳細(xì)步驟,需要的朋友可以參考下
    2022-06-06
  • vue如何修改el-form-item中的label樣式修改問題

    vue如何修改el-form-item中的label樣式修改問題

    這篇文章主要介紹了vue如何修改el-form-item中的label樣式修改問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-10-10
  • vue 動態(tài)修改a標(biāo)簽的樣式的方法

    vue 動態(tài)修改a標(biāo)簽的樣式的方法

    這篇文章主要介紹了vue 動態(tài)修改a標(biāo)簽的樣式的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-01-01
  • vue項目中vant tab改變標(biāo)簽顏色方式

    vue項目中vant tab改變標(biāo)簽顏色方式

    這篇文章主要介紹了vue項目中vant tab改變標(biāo)簽顏色方式,具有很好的參考價值,希望對大家有所幫助。
    2022-04-04
  • Vue實現(xiàn)項目部署到非根目錄及解決刷新頁面時找不到資源

    Vue實現(xiàn)項目部署到非根目錄及解決刷新頁面時找不到資源

    這篇文章主要介紹了Vue實現(xiàn)項目部署到非根目錄及解決刷新頁面時找不到資源問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-03-03
  • 渲染函數(shù) & JSX詳情

    渲染函數(shù) & JSX詳情

    本篇文章來講解渲染函數(shù) & JSX,Vue 推薦在絕大多數(shù)情況下使用模板來創(chuàng)建你的 HTML。然而在一些場景中,你真的需要 JavaScript 的完全編程的能力。這時我們可以用渲染函數(shù),它比模板更接近編譯器,需要的朋友可以參考一下
    2021-09-09
  • 詳解unplugin?vue?components不能識別組件自動導(dǎo)入類型pnpm

    詳解unplugin?vue?components不能識別組件自動導(dǎo)入類型pnpm

    這篇文章主要為大家介紹了unplugin?vue?components不能識別組件自動導(dǎo)入類型pnpm詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-01-01
  • vue組件間傳值的6種方法總結(jié)

    vue組件間傳值的6種方法總結(jié)

    這篇文章主要給大家介紹了關(guān)于vue組件間傳值的6種方法,組件是vue.js最強大的功能之一,而組件實例的作用域是相互獨立的,這就意味著不同組件之間的數(shù)據(jù)無法相互引用,需要的朋友可以參考下
    2023-08-08
  • Vue實現(xiàn)實時更新sessionStorage數(shù)據(jù)的示例代碼

    Vue實現(xiàn)實時更新sessionStorage數(shù)據(jù)的示例代碼

    這篇文章主要為大家詳細(xì)介紹了Vue如何實現(xiàn)實時更新sessionStorage數(shù)據(jù),文中的示例代碼講解詳細(xì),具有一定的參考價值,需要的可以參考一下
    2023-06-06

最新評論

大洼县| 平潭县| 浮山县| 黑龙江省| 平遥县| 临沧市| 康定县| 陕西省| 汉寿县| 南安市| 兴隆县| 吉安县| 城步| 沙田区| 黔西县| 沂南县| 阜南县| 阿拉善右旗| 咸丰县| 教育| 宝山区| 青铜峡市| 宣恩县| 岳池县| 阳高县| 东乡县| 子洲县| 白山市| 石楼县| 河源市| 二手房| 河间市| 新巴尔虎左旗| 平果县| 德格县| 长治县| 云林县| 广灵县| 哈巴河县| 扎兰屯市| 万荣县|