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

asp购物网站客户查看购物车酒店网站建设的基本内容

asp购物网站客户查看购物车,酒店网站建设的基本内容,支付网站服务费怎么做分录,wordpress 磁贴主题Element Plus 图标使用方式整理 以下是 Element Plus 图标的所有使用方式&#xff0c;包含完整代码示例和总结表格&#xff1a; 1. 按需引入图标组件 适用场景&#xff1a;仅需少量图标时&#xff0c;按需导入减少打包体积 示例代码&#xff1a; <template><div>…

Element Plus 图标使用方式整理

以下是 Element Plus 图标的所有使用方式,包含完整代码示例和总结表格:


1. 按需引入图标组件
  • 适用场景:仅需少量图标时,按需导入减少打包体积

  • 示例代码

    <template><div><!-- 直接使用导入的图标组件 --><Edit class="icon" /><Delete @click="handleClick" /></div>
    </template><script setup>
    import { Edit, Delete } from '@element-plus/icons-vue';const handleClick = () => {console.log('图标被点击');
    };
    </script><style>
    .icon {font-size: 24px;cursor: pointer;
    }
    </style>
    
  • 注释说明

    • 通过 @element-plus/icons-vue 按需导入图标组件
    • <script setup> 中导入并直接在模板中使用
    • 支持绑定点击事件等原生属性

2. 全局注册所有图标
  • 适用场景:项目需频繁使用大量图标时
  • 示例代码
    // main.js
    import { createApp } from 'vue';
    import App from './App.vue';
    import * as ElementPlusIconsVue from '@element-plus/icons-vue';
    import ElementPlus from 'element-plus';const app = createApp(App);
    app.use(ElementPlus);// 全局注册所有图标
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {app.component(key, component);
    }app.mount('#app');
    
  <!-- 组件中直接使用 --><template><Search class="global-icon" /><InfoFilled /></template>
  • 注意事项
    • 会引入所有图标,可能增加打包体积
    • 需在入口文件全局注册

3. 动态绑定图标(通过变量)
  • 适用场景:需要动态切换图标时
  • 示例代码
    <template><component :is="currentIcon" class="dynamic-icon" /><button @click="toggleIcon">切换图标</button>
    </template><script setup>
    import { ref } from 'vue';
    import { Edit, Check } from '@element-plus/icons-vue';const currentIcon = ref(Edit);const toggleIcon = () => {currentIcon.value = currentIcon.value === Edit ? Check : Edit;
    };
    </script>
    

4. 自定义图标
  • 适用场景:需使用项目专属图标时
  • 示例代码
    <!-- 自定义图标组件 CustomIcon.vue -->
    <template><svg class="custom-icon" viewBox="0 0 1024 1024"><!-- 自定义路径 --><path d="M512 1024c-282.2 0-512-229.8-512-512s229.8-512 512-512 512 229.8 512 512-229.8 512-512 512z"/></svg>
    </template><!-- 使用自定义图标 -->
    <template><CustomIcon class="custom-style" />
    </template><script setup>
    import CustomIcon from './CustomIcon.vue';
    </script>
    

5. 组合图标(Element Plus 2.3+)
  • 适用场景:需要组合多个图标时
  • 示例代码
    <template><el-icon class="combined-icon"><Edit /><Check /></el-icon>
    </template><style>
    .combined-icon .el-icon__inner {margin-right: 8px;
    }
    </style>
    

使用方式总结表格

方式适用场景代码示例注意事项
按需引入少量图标需求import { Edit } from '@element-plus/icons-vue';需逐个导入,适合小项目
全局注册大量图标需求入口文件循环注册所有图标组件可能增加打包体积
动态绑定需要动态切换图标<component :is="currentIcon" />需通过变量控制图标类型
自定义图标需要专属图标自定义 SVG 组件并导入需自行设计图标路径
组合图标需要多个图标组合<el-icon><Edit /><Check /></el-icon>需手动设置间距/样式

关键点补充

  1. 图标样式控制:通过 CSS 直接修改 font-sizecolorcursor 等属性
  2. 图标列表:所有图标名称可通过 @element-plus/icons-vue 查看
  3. 版本兼容:Element Plus 2.x+ 推荐使用 SVG 图标,旧版字体图标已弃用

如果需要进一步优化或扩展某个用法,可以随时提出!

扩展

在按钮上加图标和直接使用图标

在这里插入图片描述
在这里插入图片描述

完整代码例子

<script setup lang="ts">
import { ref } from 'vue'defineProps<{ msg: string }>()const count = ref(0)
</script><template><h1>{{ msg }}</h1><div>1234567890</div><el-button icon="Edit">Default</el-button><el-button type="primary">Primary</el-button><el-button type="success">Success</el-button><el-button type="info">Info</el-button><el-button type="warning">Warning</el-button><el-button icon="Close" type="danger">Danger</el-button><el-icon><Edit /></el-icon><div class="card"><button type="button" @click="count++">count is {{ count }}</button><p>Edit<code>components/HelloWorld.vue</code> to test HMR</p></div><p>Check out<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank">create-vue</a>, the official Vue + Vitestarter</p><p>Learn more about IDE Support for Vue in the<a href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support" target="_blank">Vue Docs Scaling up Guide</a>.</p><p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template><style scoped>
.read-the-docs {color: #888;
}
</style>

文章转载自:

http://NSalSD3t.hgfxg.cn
http://6shaiXbQ.hgfxg.cn
http://s937bcrc.hgfxg.cn
http://JuSJbWjz.hgfxg.cn
http://gFPftWUe.hgfxg.cn
http://3BZcgr0V.hgfxg.cn
http://rIZheonw.hgfxg.cn
http://fMVl5Eiy.hgfxg.cn
http://QOnBHGUP.hgfxg.cn
http://YvvOHM9n.hgfxg.cn
http://ukE6lnNZ.hgfxg.cn
http://s2QeRyaE.hgfxg.cn
http://Fp77ZNku.hgfxg.cn
http://Uf2qsBG5.hgfxg.cn
http://YyNW2SWf.hgfxg.cn
http://YtMT0AqE.hgfxg.cn
http://wPnJdO0B.hgfxg.cn
http://5JNceQRY.hgfxg.cn
http://6GHLv5EJ.hgfxg.cn
http://hCdVwGWg.hgfxg.cn
http://WFQ8ES99.hgfxg.cn
http://JaScepgz.hgfxg.cn
http://n7GgNBSP.hgfxg.cn
http://dXLArErr.hgfxg.cn
http://VspIrPaH.hgfxg.cn
http://LDDgirKj.hgfxg.cn
http://X4WyXQcO.hgfxg.cn
http://HiSBYjwn.hgfxg.cn
http://2ynebeT4.hgfxg.cn
http://GMqOfJLy.hgfxg.cn
http://www.dtcms.com/wzjs/710452.html

相关文章:

  • 公司网站建设模块中天会展中心网站建设方案
  • 跨境电商网站建设主管岗位职责做网站一般建多大的页面
  • 企业自建站案例公司 备案 网站名称
  • 西安市城乡建设档案馆网站企业推广哪个平台好
  • 襄阳网站建设兼职跨境电商全托管有哪些平台
  • 电子网站开发技术包括wordpress实现动态功能
  • 网站开发需求分析参考文献孝感做网站xgsh
  • 模板式网站建设如何用wordpress做产品页
  • 网站建设网络推广销售域名做网站出售合法吗
  • 昆明模板建站代理上高做网站公司
  • 做检索网站思茅网站建设
  • 站酷网官网进入商务网站建设步骤
  • 佛山网站建设全方位服务网站动态添加广告怎么做的
  • 青岛专业网站建设定制免费封面设计在线生成软件
  • 如何判断网站做的关键词专做商品折扣的网站
  • 网站开发私人培训6网站建设做网站
  • 做一个自己的网站帮别人做网站哪里可以接单
  • 手机ppt在哪个网站做网站如何推广
  • 徐州网站制作企业通辽做网站制作公司
  • 花溪网站建设代理服务器ip免费
  • 网站开发常用语言给个高质量的网站
  • 企业为什么要做网站 作用是什么怎样建设自己的视频网站
  • 怎样才能做一个手机网站wordpress加目录
  • 鞍山网站怎么做出来的坐什么网站能用到html5
  • 做网页设计的网站江门网站优化快速排名
  • 编辑网站如何上传图片到网站
  • 美食网站黑米如何做oa办公软件手机版
  • 个人网站做淘宝客犯法吗毕业设计网站开发题目
  • 网站编程教学烟台门户网站
  • 天津餐饮网站建设wordpress发布时间精确到秒