随笔分类 -  Vue学习之路

存储Vue的学习笔记
摘要:引入资源 首先引入Vue,之后引入element-ui。 引入组件 返回数据 全部代码 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <!-- 开发环境版本,包含了有帮助的命令行 阅读全文
posted @ 2022-01-27 13:43 胸怀丶若谷 阅读(1426) 评论(0) 推荐(0) 编辑
摘要:配置 main.js文件修改 在main.js中进行如下修改 // 设置axios全局api import axios from 'axios' // 请求基准路径的配置 后台 axios.defaults.baseURL = 'http://127.0.0.1:8000/' 使用 axios.po 阅读全文
posted @ 2021-12-29 13:27 胸怀丶若谷 阅读(367) 评论(0) 推荐(0) 编辑
摘要:解决方案 这是由于this的指向有问题,我们只需要重新声明一下this就可以重新调用了 阅读全文
posted @ 2021-12-29 13:20 胸怀丶若谷 阅读(13913) 评论(0) 推荐(0) 编辑
摘要:错误原因,我猜测多半是版本问题 在router/index.js中添加如下代码 const originalPush = VueRouter.prototype.push VueRouter.prototype.push = function push(location) { return orig 阅读全文
posted @ 2021-10-26 20:12 胸怀丶若谷 阅读(297) 评论(0) 推荐(0) 编辑
摘要:创建vue文件模板 打开vscode,文件–>首选项—>用户代码片段,在弹出的搜索框中输入vue,回车 删除原内容,将如下内容粘贴 { "Print to console": { "prefix": "vue", "body": [ "<!-- $1 -->", "<template>", "<di 阅读全文
posted @ 2021-10-26 19:42 胸怀丶若谷 阅读(272) 评论(0) 推荐(0) 编辑
摘要:原因 我这里是因为我代码中的方法不存在,我漏写了,后补充上就好了 解决方案 在methods中添加如下代码: // 修改登录状态 changeLoginType(bool){ this.loginType = bool } 阅读全文
posted @ 2021-10-07 19:00 胸怀丶若谷 阅读(428) 评论(0) 推荐(0) 编辑
摘要:解决方案 错误代码如下所示: <router-view @hideBox="hideLoginRegisterBox" @changeUI="changeLoginType"/> 报错如下所示: 修改代码如下: <router-view @hideBox="hideLoginRegisterBox" 阅读全文
posted @ 2021-10-07 18:51 胸怀丶若谷 阅读(1195) 评论(0) 推荐(0) 编辑
摘要:原因 main.js文件中没有引入store 解决方案 添加如下代码即可 import store from "./store"; new Vue({ el: '#app', router, store, render: h => h(App) }) 阅读全文
posted @ 2021-10-02 16:18 胸怀丶若谷 阅读(1764) 评论(0) 推荐(0) 编辑
摘要:GET请求 向后端请求时,通过URL向后端传递参数 axios({ url:'http://127.0.0.1:9000/get-user-list/', type:'json', //GET方法携带数据的方式 params:{ id: id }, method:'get' }) POST请求 向后 阅读全文
posted @ 2021-09-24 22:23 胸怀丶若谷 阅读(68) 评论(0) 推荐(0) 编辑
摘要:错误代码 解决方案 删除div标签。修改后,如下所示: 阅读全文
posted @ 2021-08-30 11:47 胸怀丶若谷 阅读(2185) 评论(0) 推荐(0) 编辑
摘要:输入以下命令 npm config set proxy null npm config set https-proxy null 之后重新安装即可 文章参考 https://blog.csdn.net/yypsober/article/details/51906616 阅读全文
posted @ 2021-08-29 19:35 胸怀丶若谷 阅读(2872) 评论(0) 推荐(0) 编辑
摘要:改为这样,把所有值设为true mounted() { // 滚动条 this.scroll = new BScroll(this.$refs.wrapper, { click: true, observeDOM: true, observeImage: true, // 监听 probeType: 阅读全文
posted @ 2021-08-26 10:33 胸怀丶若谷 阅读(767) 评论(0) 推荐(0) 编辑
摘要:错误代码 <swiper> <swiper-item v-for="item in banners"> <a :href="item.link"> <img :src="item.image" alt=""> </a> </swiper-item> </swiper> 正确代码 <swiper> < 阅读全文
posted @ 2021-08-20 16:53 胸怀丶若谷 阅读(844) 评论(0) 推荐(0) 编辑
摘要:安装并引用 安装 npm install vue-router ##引用 步骤一:在src路径下,创建router文件夹, 其下创建index.js // router/index.js import Vue from 'vue' import VueRouter from 'vue-router' 阅读全文
posted @ 2021-08-20 10:48 胸怀丶若谷 阅读(95) 评论(0) 推荐(0) 编辑
摘要:#vue cli 3的写法 module.exports = { configureWebpack: { resolve:{ extensions:[], alias:{ 'assets':'@/assets', 'common':'@/common', 'components':'@/compon 阅读全文
posted @ 2021-08-20 10:43 胸怀丶若谷 阅读(174) 评论(0) 推荐(0) 编辑
摘要:$route对象 该对象表示当前的路由信息,包含当前URL解析得到的信息。包含当前的路径,参数,query对象等。其常用方法如下所示: $route.path 字符串,对应当前路由的路径,总是解析为绝对路径,如"/foo/bar" $route.params 一个 key/value 对象,包含了 阅读全文
posted @ 2021-08-12 14:20 胸怀丶若谷 阅读(123) 评论(0) 推荐(0) 编辑
摘要:配置文件的分离 目的就是让开发环境, 生产环境,测试环境的配置分隔开 步骤一: 在项目根目录下创建一个 build 文件夹专门用来存放配置文件,再创建三个js文件, base.config.js 文件,存放基本配置,开发阶段和生产阶段都需要的配置, 也就是公共配置 dev.config.js 文件, 阅读全文
posted @ 2021-08-05 15:23 胸怀丶若谷 阅读(74) 评论(0) 推荐(0) 编辑
摘要:#原因 webpack经常出现版本不兼容问题,vue-loader在15以前的版本打包时候会自动生成VueLoaderPlugin,但是现在需要手动去wepack.config.js文件中去加入,如下图所示 const VueLoaderPlugin = require('vue-loader/li 阅读全文
posted @ 2021-08-05 11:03 胸怀丶若谷 阅读(652) 评论(0) 推荐(0) 编辑
摘要:这个问题主要是因为node-loader版本过高导致的问题 解决方案 css-loader降为3.6.0版本即可 npm install css-loader@2.0.2 --save-dev npm install style-loader@0.23.1 --save-dev 重新运行npm ru 阅读全文
posted @ 2021-08-04 16:38 胸怀丶若谷 阅读(3972) 评论(2) 推荐(3) 编辑
摘要:学前准备 vue官网:https://cn.vuejs.org/ 工具: webstorm, vscode Vue基础 初体验 <div id="app">{{message}}</div> <script> // 声明式编程 const app = new Vue({ //用于挂载要管理的元素 e 阅读全文
posted @ 2021-07-31 21:17 胸怀丶若谷 阅读(97) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示