Vue问题记录
来源:互联网 发布:windows一键还原软件 编辑:程序博客网 时间:2024/06/05 06:34
1.[Vue warn]: Error in mounted hook:
在vue文件中的mounted方法中使用了this.items,但是在data() return 中没有写返回items,在data()中return中加入 items: [] 就没问题了
2.传boolean值给控件
<component :isBack=false></component>
3.图片路径问题
在同一个.vue文件中,在style中,路径是在这个vue相对img的路径的,在script中,图片路径是相对index.html
4.XMLHttpRequest cannot load http://localhost:3000/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 500.
之前get的时候是没有问题的,之后发现是post未接收到数据,导致请求出错。
请求的时候,使用queryString()
import axios from "axios"var qs = require('qs'); axios.post(global.API + path, qs.stringify({ username: username, password: pwd }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded', } }).then((res) => { let { data, code } = res.data; if (code == 200) { //....... } else { //....... } }, (res) => { console.log(res.status); });
后台处理请求
var bodyParser=require('body-parser');var app = express();app.use(bodyParser.json());app.use(bodyParser.urlencoded({ extended: false }));app.post("/login", (req, res) => { let name = req.body.username; let pwd = req.body.password; //.........}
0 0
- Vue问题记录
- vue实践过程问题记录
- VUE开始之路的问题记录
- vue unit及e2e问题记录
- Vue 使用过程中的问题记录
- 记录 vue-cli build 打包之后的问题
- vue搭建项目时遇到的一些问题记录
- vue学习记录 vue-router
- vue vue-router vue-resource学习记录
- vue+webpack学习记录
- vue 学习记录
- vue.js分享记录
- node+vue记录
- Vue.js学习记录
- vue踩坑记录
- Vue.js 开发记录
- vue.js初学记录
- vue 学习记录
- 指针的那些事
- 基础dp之——hd1257 最少拦截系统
- 面试中关于TCP UDP HTTP HTTPS的问题
- selenium2java自定义一个输出当前时间的方法
- 文件句柄(file handles) & 文件描述符(file descriptors)
- Vue问题记录
- 如何在github上传自己的项目
- 查看storm运行日志
- spark入门详解
- 01背包+完全背包+多重背包模板
- 【转载】终于解决这个难题了:安装mysql server5.5 到start service未响应
- GBDT(MART) 迭代决策树入门教程 | 简介
- 技术的热门度曲线
- [容斥原理 DP] BZOJ 4767 两双手