vue使用ionic图标_Ionic团队的Vue图标集组件

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 18:23   770   0

vue使用ionic图标

声子 (vue-ionicons)

Vue Icon Set Components from Ionic Team

Ionic团队的Vue图标集组件

Design Icons, sourced from the Ionicons project.

设计图标,来自Ionicons项目。

入门 (Getting started)

  1. Install the package

    安装套件

    $ npm install --save vue-ionicons

    OR

    要么

    $ yarn add vue-ionicons
  2. Import the icon, and declare it as a local component:

    导入图标,并将其声明为本地组件:

    import AlertIcon from 'vue-ionicons/alert.vue'
    
    components: {
      AlertIcon
    }

    OR

    要么

    Declare it as a global component:

    将其声明为全局组件:

    import AlertIcon from 'vue-ionicons/alert.vue'
    
    Vue.component('menu-icon', AlertIcon)

    Note Icon files are kebab cased, e.g. alert-circle.vue, and their default name has -icon appended e.g. alert-circle-icon.

    注意图标文件烤肉套管,如alert-circle.vue ,他们的默认名称具有-icon附加例如alert-circle-icon

  3. Then use it in your template code!

    然后在您的模板代码中使用它!

    <menu-icon />

图示 (Icons)

A list of the icons can be found at the Ionicons Repository

图标列表可在Ionicons存储库中找到

提示 (Tips)

  • Use resolve in your Webpack config to clean up the imports:

    在Webpack配置中使用resolve清理导入:

    resolve: {
       alias : {
         "icons": path.resolve(__dirname, "node_modules/vue-ionicons")
       },
      extensions: [
        ".vue"
      ]
    }

    This will give you much shorter and more readable imports, like import Android from 'icons/android', rather than import Android from 'vue-ionicons/android.vue'. Much better!

    这将为您提供更短,更易读的导入,例如import Android from 'icons/android' import Android from 'vue-ionicons/android.vue' ,而不是import Android from 'vue-ionicons/android.vue' 。 好多了!

翻译自: https://vuejsexamples.com/vue-icon-set-components-from-ionic-team/

vue使用ionic图标

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP