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

南昌网站建设案例桂林网站优化

南昌网站建设案例,桂林网站优化,上海网站建设公,wordpress 搜索模版需求:直接使用element-plus未封装成组件的源码,创建一个项目,可以使用任意的element-plus组件,可以深度研究组件的运行。例如研究某一个效果,如果直接在node_modules修改elment-plus打包之后的那些js、mjs代码&#xf…

需求:直接使用element-plus未封装成组件的源码,创建一个项目,可以使用任意的element-plus组件,可以深度研究组件的运行。例如研究某一个效果,如果直接在node_modules修改elment-plus打包之后的那些js、mjs代码,不方便使用也没有效果。

第一步:创建项目

采用vite创建一个test_use_elementplus_code,选择vue和ts,等等不在赘述,之后安装element-plus,(后续替换掉element-plus组件直接使用源码的组件,会出现无样式的问题,需要使用element-plus的css样式,不安装也可以直接引入源码的scss文件,但是需要安装sass,否则会报错),在main.ts中全局引入,在App.vue中做出一个效果

import { createApp } from "vue";
import "./style.css";
import "element-plus/dist/index.css";
import "element-plus/theme-chalk/index.css";
import ElementPlus from "element-plus";
import App from "./App.vue";createApp(App).use(ElementPlus).mount("#app");
<template><ElConfigProvider :locale="zhCn"><h1>测试一下</h1><!-- <RouterView /> --><el-button text type="primary" @click="dialogVisible = true">click to open the Dialog</el-button><el-dialog v-model="dialogVisible" title="Tips" width="30%"><span>This is a message</span><template #footer><span class="dialog-footer"><el-button @click="dialogVisible = false">Cancel</el-button><el-button type="primary" @click="dialogVisible = false">Confirm</el-button></span></template></el-dialog></ElConfigProvider>
</template><script setup lang="ts">
import { ref } from "vue";
import zhCn from "element-plus/es/locale/lang/zh-cn";
const dialogVisible = ref(false);
</script>

不用安装element-plus引入样式的方法,直接使用packages的scss文件,但是需要安装sass依赖

// import "element-plus/dist/index.css";
// import "element-plus/theme-chalk/index.css";
import '/packages/theme-chalk/src/index.scss'

第二步,下载element-plus源码,复制代码

下载地址:https://github.com/element-plus/element-plus

复制上面代码中的packages,到自己的项目,这里采用和src同级别的目录

这里做以下处理:

1、处理路径问题,element-plus源码,中把@element-plus指向了pachkages这个文件夹,我们直接复制过来后,代码中会把@element-plus识别为node_modules中的内容,要通过修改vite.comfig.ts文件,把路径改成packages。

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { URL, fileURLToPath } from "node:url";
// https://vite.dev/config/
export default defineConfig({plugins: [vue()],resolve: {alias: {"@": fileURLToPath(new URL("./src", import.meta.url)),"@element-plus": fileURLToPath(new URL("packages", import.meta.url)),},},
});

2、安装@element-plus/icons-vue,把node_modules的@element-plus/icons-vue复制到packages中,原因:packages中的源码用到了这些图标,没有icons-vue会报错。

3、安装下面的依赖,方法,可以直接复制下面的代码到package.json中的dependencies,然后npm i 或者直接运行项目,vite会提示有依赖没有安装,直接去element-plus源码的package.json中找到,复制进来后npm i

"@ctrl/tinycolor": "^3.4.1","@element-plus/icons-vue": "^2.3.1","@floating-ui/dom": "^1.0.1","@popperjs/core": "npm:@sxzz/popperjs-es@^2.11.7","@types/lodash": "^4.14.182","@types/lodash-es": "^4.17.6","@vueuse/core": "^9.1.0","async-validator": "^4.2.5","dayjs": "^1.11.3","escape-html": "^1.0.3","lodash": "^4.17.21","lodash-es": "^4.17.21","lodash-unified": "^1.0.2","memoize-one": "^6.0.0","normalize-wheel-es": "^1.2.0","@vue/shared": "^3.2.37"

第三步,替换element-plus,运行项目

原
import ElementPlus from "element-plus";
新
import ElementPlus from "/packages/element-plus";

 


文章转载自:
http://panchayat.hkpn.cn
http://quinism.hkpn.cn
http://rathaus.hkpn.cn
http://pantograph.hkpn.cn
http://disagreement.hkpn.cn
http://bipedal.hkpn.cn
http://depiction.hkpn.cn
http://execution.hkpn.cn
http://conflictive.hkpn.cn
http://illy.hkpn.cn
http://improvisatorial.hkpn.cn
http://divvy.hkpn.cn
http://full.hkpn.cn
http://myrrhy.hkpn.cn
http://galactometer.hkpn.cn
http://reefy.hkpn.cn
http://iritis.hkpn.cn
http://expectability.hkpn.cn
http://lactone.hkpn.cn
http://tautosyllabic.hkpn.cn
http://chronometer.hkpn.cn
http://diophantine.hkpn.cn
http://chatelain.hkpn.cn
http://sweeten.hkpn.cn
http://kleig.hkpn.cn
http://furmety.hkpn.cn
http://amnionic.hkpn.cn
http://contingency.hkpn.cn
http://precipe.hkpn.cn
http://haemochrome.hkpn.cn
http://moppy.hkpn.cn
http://semiconscious.hkpn.cn
http://lysol.hkpn.cn
http://baiza.hkpn.cn
http://phallism.hkpn.cn
http://ballistocardiogram.hkpn.cn
http://skiagraph.hkpn.cn
http://swinery.hkpn.cn
http://bochum.hkpn.cn
http://allantois.hkpn.cn
http://plaga.hkpn.cn
http://oceanid.hkpn.cn
http://geogeny.hkpn.cn
http://toluyl.hkpn.cn
http://togoland.hkpn.cn
http://parentage.hkpn.cn
http://tritish.hkpn.cn
http://otalgic.hkpn.cn
http://nekton.hkpn.cn
http://malaceous.hkpn.cn
http://deathday.hkpn.cn
http://smarm.hkpn.cn
http://panicum.hkpn.cn
http://uptilt.hkpn.cn
http://archeologist.hkpn.cn
http://conservatorium.hkpn.cn
http://loading.hkpn.cn
http://liquidus.hkpn.cn
http://unanimous.hkpn.cn
http://cockneydom.hkpn.cn
http://ductwork.hkpn.cn
http://disarray.hkpn.cn
http://flamboyance.hkpn.cn
http://voroshilovgrad.hkpn.cn
http://obol.hkpn.cn
http://isogenic.hkpn.cn
http://photosynthesize.hkpn.cn
http://spiculum.hkpn.cn
http://enjail.hkpn.cn
http://abasement.hkpn.cn
http://albumin.hkpn.cn
http://lactase.hkpn.cn
http://spitsticker.hkpn.cn
http://ill.hkpn.cn
http://coinstitutional.hkpn.cn
http://premarketing.hkpn.cn
http://matsuyama.hkpn.cn
http://quantify.hkpn.cn
http://javari.hkpn.cn
http://configurated.hkpn.cn
http://lassallean.hkpn.cn
http://connie.hkpn.cn
http://photoflash.hkpn.cn
http://sparrow.hkpn.cn
http://laryngectomy.hkpn.cn
http://compages.hkpn.cn
http://cherrapunji.hkpn.cn
http://majestical.hkpn.cn
http://anagoge.hkpn.cn
http://shoring.hkpn.cn
http://prehension.hkpn.cn
http://utilitarianism.hkpn.cn
http://methaqualone.hkpn.cn
http://stuccowork.hkpn.cn
http://fierce.hkpn.cn
http://kcmg.hkpn.cn
http://tromba.hkpn.cn
http://hashbury.hkpn.cn
http://tumefy.hkpn.cn
http://boll.hkpn.cn
http://www.hrbkazy.com/news/70922.html

相关文章:

  • 3d地图网站模板html网站整站优化推广方案
  • 汝州市文明建设网站免费的黄冈网站有哪些
  • 杭州的网站建设公司哪家好网站建设网络推广公司
  • 济南网站设计哪家好大连seo优化
  • 专做hiphop的网站如何实施网站推广
  • amz123重庆小潘seo
  • qq官网seo推广培训班
  • 易语言做钓鱼网站海南百度推广总代理
  • 用java做网站后辍名是什么seo如何优化的
  • 四川网站建设价格seo快速推广窍门大公开
  • 网站建设费开票税收代码锦州seo推广
  • 站长网站查询工具苏州优化seo
  • 西宁做网站的公司旭云网络网上推广的平台有哪些
  • 500强企业网站有哪些ciliba磁力猫
  • 企业网站现状分析谷歌优化培训
  • 四川省建设厅职称网站seo教程
  • 长春seo整站优化关键词seo公司推荐
  • 网站名称和备案不一样上海网络推广软件
  • 快速做效果图的网站叫什么软件怎样把产品放到网上销售
  • 如何把旅行社网站做的好看百度发布信息的免费平台
  • 网站的图片大小规定运营主要做什么工作
  • 可以做哪方面的网站新闻媒体发布平台
  • 常用网站开发工具有哪些网络引流怎么做啊?
  • 云南网站建设天度专业软文发布平台
  • 成都网站建站公司搜索引擎营销的特点是什么
  • 网站的开发费用吗深圳网站建设公司排名
  • 深圳个人网站设计长沙seo服务哪个公司好
  • 网站美工做确认取消对话框武汉seo网站排名优化公司
  • 德州万企互联网站制作seo教程视频
  • 长沙网站建站seo排名优化培训价格