
Vue
从基础逐渐深入
每一天,每一步
相信自己,你可以的
展开
-
vue el-date-picker禁用当前日期之前的日、小时、分钟
【代码】vue el-date-picker禁用当前日期之前的日、小时、分钟。原创 2024-09-20 18:20:03 · 651 阅读 · 0 评论 -
vue elementUI el-date-picker [Vue warn]: Avoid mutating a prop directly since the value will be over
第一种:el-date-picker处添加属性placement="bottom-start"。第二种:指定elementUI版本为2.15.8,重新安装依赖。原创 2024-06-07 13:58:36 · 473 阅读 · 0 评论 -
momentjs格式化12位日期时间为连字符的样式,如YYYY-MM-DD HH:mm:ss
【代码】momentjs格式化12位日期时间为连字符的样式,如YYYY-MM-DD HH:mm:ss。原创 2024-06-07 13:54:20 · 193 阅读 · 0 评论 -
vue el-table :data动态绑定变量
问题:vue el-table :data想要动态绑定不同的变量作为表格数据。解决:使用三元表达式。原创 2024-06-07 13:51:48 · 324 阅读 · 0 评论 -
vue触发原生form提交到指定action地址
【代码】vue触发原生form提交到指定action地址。原创 2024-05-08 15:21:20 · 658 阅读 · 0 评论 -
解决vue elementUI el-tabs默认选项下划线不显示的问题
【代码】解决vue elementUI el-tabs默认选项下划线不显示的问题。原创 2024-05-07 16:48:24 · 1701 阅读 · 1 评论 -
vue实现可拖拽图标,图标默认显示在右下角
【代码】vue实现可拖拽图标,图标默认显示在右下角。原创 2024-04-23 15:04:38 · 804 阅读 · 0 评论 -
vue echarts地图
范围选择器右侧行政区划范围中输入需要选择的省份或地市,选择自己想要的数据格式,这里选择了geojson格式,点右侧的蓝色按钮复制到浏览器地址栏中,打开的geojson文件内容右键另存为json文件即可。原创 2024-01-22 17:18:46 · 920 阅读 · 0 评论 -
npm如何设置淘宝的镜像源模式
2. 全局配置npm使用淘宝镜像作为默认下载源。1. 查看当前npm的下载源。原创 2023-08-16 15:12:11 · 2059 阅读 · 0 评论 -
Edge浏览器安装vue devtools
在文件夹空白处,点击鼠标右键选择:git bush here。3. 在上一步打开的git窗口中安装依赖。4. 成功安装依赖后在git窗口中打包构建。2. 下载后的压缩包解压并打开文件夹。原创 2023-08-02 11:04:32 · 2746 阅读 · 3 评论 -
vue bus总线传值
【代码】vue bus总线传值。原创 2023-08-02 11:03:35 · 211 阅读 · 0 评论 -
iconfont字体图标的引用
iconfont-国内功能很强大且图标内容很丰富的矢量图标库,提供矢量图标下载、在线存储、格式转换等功能。阿里巴巴体验团队倾力打造,设计和前端开发的便捷工具。4. 点击右侧的使用帮助,页面下拉可以看到Unicode、font-class、symbol三种引用方式的使用步骤,按照步骤操作即可。官网:giconfont-阿里巴巴矢量图标库。2. 选择想要使用的图标,添加入库。3. 打开库,将图标添加至项目。1. 搜索图标,如:首页。原创 2023-06-09 16:05:13 · 320 阅读 · 0 评论 -
react实现数据可视化大屏自适应
react实现数据可视化大屏自适应参考:数据大屏最简单自适应方案,无需适配rem单位 - 掘金原创 2023-05-29 14:49:09 · 1172 阅读 · 0 评论 -
elementui upload限制只能上传一个文件,且覆盖上传
实际项目中想要的效果是:限制只能上传一个文件,并且直接覆盖原来的文件上传。此时删除 :limit="1"和:on-exceed="exceedFile",在on-change的fileChange中通过this.fileList = [fileList[fileList.length - 1]];获取最后一次选择的文件即可。在使用elementui的Upload 上传组件时,如下代码中使用了limit限定了上传的文件数量,并且做了上传文件数量超限的提示。原创 2023-02-16 13:59:07 · 7795 阅读 · 3 评论 -
vue使用xlsx导出excel报错 Cannot read properties of undefined (reading ‘utils‘)
【代码】vue使用xlsx导出excel报错 Cannot read properties of undefined (reading ‘utils‘)原创 2023-02-15 10:13:26 · 1481 阅读 · 0 评论 -
vue element-ui修改Dropdown下拉菜单默认背景颜色
问题:vue项目中使用了element-ui的Dropdown下拉菜单el-dropdown,想要修改其默认样式。分析:el-dropdown下拉菜单渲染后的组件元素中包含有el-popover,此处需要尤其注意。原创 2023-02-04 17:20:58 · 7418 阅读 · 2 评论 -
Vuex:Computed property “xxx“ was assigned to but it has no setter.
Vuex:Computed property "xxx" was assigned to but it has no setter.原创 2022-07-09 22:19:40 · 2221 阅读 · 0 评论 -
vue+ elementUI纯前端下载excel文件模板 React可直接使用同样方法下载静态资源文件
在项目public目录下新建static文件夹,放入“fileTemp.xlsx”文件即可实现vue+ elementUI纯前端下载excel文件模板。React项目也可以直接使用downloadExcel方法下载。如果本地启动项目,下载提示:“无法从网站上提取文件”,将。原创 2022-05-26 15:31:22 · 3981 阅读 · 8 评论 -
vue项目中按需引入element-ui较多时的封装
1. vue项目src目录下新建plugins文件夹,新建element.js:// 按需引入import { Button, Menu, Submenu, Input, MenuItem, MenuItemGroup, Scrollbar} from "element-ui";export default { components: [ Button, Menu, Submenu, Input, MenuItem, MenuItemGroup, Scrollbar ..原创 2022-03-21 15:49:23 · 968 阅读 · 0 评论 -
vue项目中按需引入element-ui的正确方法
1. 创建vue项目(版本@vue/cli 4.5.4):vue create test2.安装 babel-plugin-component:npm install babel-plugin-component -D3.安装element-ui:npm install element-ui -S4. 修改babel.config.js配置文件:module.exports = { presets: [ '@vue/cli-plugin-babel/pre..原创 2022-03-21 15:28:10 · 2877 阅读 · 0 评论 -
Vue单机项目唯一ID生成器NanoID的使用
UUID是软件开发中最常用的通用标识符之一。nanoid库和uuid库一样都可以生成uuid,但是nanoid相比uuid要更轻量级。nanoid的安装:npm i nanoid// 或者 yarn add nanoidnanoid的使用:import { nanoid } from 'nanoid'let id = nanoid()//也可以指定生成字符串的长度//let id = nanoid(5)...原创 2022-02-27 16:22:55 · 1058 阅读 · 0 评论 -
Vue项目中查看所有的webpack、less-loader版本命令:npm view xxx versions
想要查看所有的webpack、less-loader版本使用下面的命令:npm view webpack versionsnpm view less-loader versions原创 2022-02-27 14:54:37 · 3756 阅读 · 0 评论 -
vue cli插件plugins的使用
应用场景:vue cli插件plugins中的方法均可以被任意组件调用,增强Vue的功能。首先在创建好的vue项目的src目录下新建plugins.js:export default { install(Vue) { // 全局过滤器 Vue.filter('mySlice', function(value){ return value.slice(0, 4); }); // 自定义指令 Vue.directive('fbind',原创 2022-02-26 18:20:17 · 1737 阅读 · 0 评论 -
vue cli 局部混入mixin和全局混入mixin
应用场景:两个组件,都需要用到同一个点击事件方法,此时使用mixin混入,可以很好的实现代码的复用。在vue cli搭建的项目中,src目录下新建mixin.js文件:// 对外暴露mixin对象export const mixin = { data() { return { msg: 'hello' } }, methods: { click() { alert('你点我了') } }}export const原创 2022-02-26 18:00:28 · 1093 阅读 · 0 评论 -
vue cli关闭eslint语法检查
官网地址:配置参考 | Vue CLI在项目根目录下添加vue.config.js文件,文件中写入lintOnSave配置项:module.exports = { lintOnSave: false}重新运行项目即可关闭eslint语法检查。原创 2022-02-26 17:25:54 · 1685 阅读 · 0 评论 -
vue-router.esm.js?ac56:2316 TypeError: Cannot read properties of undefined (reading ‘$createElement‘
报错:vue-router.esm.js?ac56:2316 TypeError: Cannot read properties of undefined (reading '$createElement')错误原因:把routes配置项的component写成了components。修改后解决报错。原创 2021-12-05 15:29:57 · 3011 阅读 · 0 评论 -
vue-router.esm.js?ac56:2316 TypeError: Cannot create property ‘_Ctor‘ on string ‘H‘
报错:vue-router.esm.js?ac56:2316 TypeError: Cannot create property '_Ctor' on string 'H'错误的把配置项routes中的component:变量名,写成了字符串'',修改后不在报错。原创 2021-12-05 15:28:32 · 2174 阅读 · 3 评论 -
无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\vue.ps1,因为在此系统中禁止执行脚本。有关详细信息,请参阅 “get-help about_s
vue create XX搭建Vue-cli3项目时报错:无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\vue.ps1,因为在此系统中禁止执行脚本。有关详细信息,请参阅 "get-help about_signing"。所在位置 行:1 字符: 4+ vue <<<< create 10 + CategoryInfo : NotSpecified: (:) [], PSSecurityExce原创 2021-12-05 12:00:40 · 8626 阅读 · 0 评论 -
vue keep-alive prop exclude使用小坑:使用逗号分隔字符串时不能加空格
vue keep-alive prop exclude使用小坑:使用逗号分隔字符串时不能加空格原创 2021-12-02 21:00:00 · 435 阅读 · 0 评论 -
vue页面加载默认进入vue-router嵌套子路由,并使用keep-alive对组件进行缓存
需求:Home组件下有2个子组件:News、Products。1. 页面加载直接进入home/news;2. 缓存home组件中的状态。实现:Home.vue data() { return { path: '/home/news' } }, // 进入home则激活 activated() { console.log('actived'); this.$router.push(t原创 2021-12-01 21:30:00 · 1014 阅读 · 0 评论 -
vue params传参注意事项:使用命名路由,才能将传入的参数显示到url地址上
路由配置为非命名路由时: { path: '/user/:id', component: User }页面中params传参: <router-link :to="{path: 'user', params: {id: 1}}">用户</router-link> 效果:url中不显示传入的参数------------------------------------------------------------------------原创 2021-12-01 11:54:13 · 1481 阅读 · 0 评论 -
Vue Router构建选项linkActiveClass全局配置菜单高亮显示遇到的问题:默认第一个router-link高亮,点击第2个router-link第一个高亮不会被去除
目录:初始代码如下:App.vue:<template> <div id="app"> <router-link to="/">首页</router-link> <router-link to="/about">关于</router-link> <router-view /> </div></template><script>exp原创 2021-11-30 22:52:59 · 1224 阅读 · 0 评论 -
Failed to compile../src/views/sagc/component/EchartLine.vue?vue&type=script&lang=js& (./node_modul
问题产生:项目拉取运行后提示如下。Failed to compile../src/views/sagc/component/EchartLine.vue?vue&type=script&lang=js& (./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./n原创 2021-11-29 21:00:00 · 5275 阅读 · 0 评论 -
[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available
[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.原创 2021-11-19 21:00:00 · 1020 阅读 · 0 评论 -
Vue组件的几种声明方式:Vue.extend、语法糖、script的type=“text/x-template“、template标签
1、Vue.extend构造器// 构造器 声明const cpn2 = Vue.extend({ template: ` <h2>这是一个组件</h2> `});// vue实例中挂载注册为局部组件components: { cpn2}// 全局组件Vue.component('cpn2', cpn2);// HTML代码中使用<cpn2></cpn2>2.语法糖// vue实例中挂载注册..原创 2021-11-14 11:47:36 · 1412 阅读 · 0 评论 -
Vue input元素复用的管理:为input添加key,否则在输入框中输入文本后切换文本框的显示,已输入的文本不会被替换掉
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document&l.原创 2021-11-10 22:00:00 · 891 阅读 · 0 评论 -
Vue v-on的事件参数传递问题
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document&l.原创 2021-11-10 21:00:00 · 1294 阅读 · 2 评论 -
代码更改自动重启Nodemon的使用
1. 初始化项目mkdir projectcd projectnpm init --yes2. 全局安装nodemon:cnpm i nodemon -g3. 查看是否安装成功:nodemon --version4. 项目根目录中新建index.js,终端执行:nodemon index.jsindex.js中代码修改后终端即可实时看到输出结果。...原创 2021-10-11 16:38:14 · 104 阅读 · 0 评论 -
Vue预渲染prerender-spa-plugin的使用,改善少数营销页面的 SEO
1. 安装:cnpm i prerender-spa-plugin -D2. 配置:webpack.prod.conf.js:const PrerenderSPAPlugin = require('prerender-spa-plugin')const Renderer = PrerenderSPAPlugin.PuppeteerRenderer...plugins: [... // 预渲染 new PrerenderSPAPlugin({ //必需.原创 2021-10-11 10:51:04 · 615 阅读 · 0 评论 -
vue-skeleton-webpack-plugin多页面加载不同的骨架屏效果的实现
在vue-skeleton-webpack-plugin单页面骨架屏效果的实现https://blog.youkuaiyun.com/u010234868/article/details/120675095原创 2021-10-09 18:07:59 · 491 阅读 · 0 评论