码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • vue3项目,vite+vue3+ts+pinia(9)-初识ElementPlus


    1. Element plus 官网:https://element-plus.gitee.io/zh-CN/
    2. 安装 npm install element-plus --save
    3. 它分是: 完整引入和按需引入,这里项目我是用element plus写的,就用完整引入
    4. 在src目录下新建 plugins 文件, 再新建 element-plus.ts
    import { App } from 'vue'
    import elementPlus from 'element-plus'
    import 'element-plus/dist/index.css'
    
    export default {
      install (app: App) {
        app.use(elementPlus)
      }
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    1. 在main.ts 中引入 element plus 插件
    // 引入element plus
    import elementPlus from './plugins/element-plus'
    createApp(App)
      .use(router)
      .use(createPinia())
      .use(elementPlus)
      .mount('#app')
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    1. 在src=> views => login => indexName.vue 中
    <template>
      <div>
        <el-button type="primary">Primary</el-button>
      </div>
    </template>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    1. 终端: npm run dev
    2. 再在浏览器输入地址,就可以看到了
    3. 如果感觉element plus 按钮大了,也可以全局设置,在 plgins => element-plus.ts
    import { App } from 'vue'
    import elementPlus from 'element-plus'
    import 'element-plus/dist/index.css'
    
    export default {
      install (app: App) {
        app.use(elementPlus, { size: 'small', zIndex: 2000 })
      }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    1. 也可以在局部设置 views => login => indexName.vue
    <el-button type="primary" size="large">Primary</el-button>
    
    • 1
    1. 发现按钮变大了
    2. 国际化, 后面再讲,目前使用是element plus 自带的
    3. 看element plus 官网(https://element-plus.gitee.io/zh-CN/guide/i18n.html),
    4. 直接在App.vue中,就okl了
    <template>
      <el-config-provider :locale="locale">
        <router-view />
      </el-config-provider>
    </template>
    
    <script setup lang="ts">
    import { ElConfigProvider } from 'element-plus'
    import locale from 'element-plus/dist/locale/zh-cn.mjs'
    
    </script>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
  • 相关阅读:
    Redis的基本操作与应用(附相关面试题...)
    女生适不适合干软件测试这一行?“钱”程如何?适合长期发展不?
    qt对于一个QWidget的所有事件
    IP-guard getdatarecord 存在任意文件读取
    IoT知识点补充
    Colmap 实用教程 —— 整体介绍
    睿趣科技:现在做抖音网店卖啥好
    get/post请求使用工具(apifox/postman/浏览器)能请求通但是java代码不行的问题解决
    数据结构——栈的详细介绍
    Java数据结构之深度解析二叉树
  • 原文地址:https://blog.csdn.net/ybilss/article/details/127894770
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号