
Vue
糖薪砖
这个作者很懒,什么都没留下…
展开
-
<template> cannot be keyed. Place the key on real elements instead.
<--! 以下代码编译的时候提示错误 --><template v-for="(m, key) in menus" :key="m.id"> {{m.menuName}}</template>原因:不支持在 <template> 元素上绑定属性。比如这里想绑定 key 属性就不行。解决办法:改用 <div>...原创 2019-04-10 16:39:58 · 13470 阅读 · 0 评论 -
使用 axios 后导致 thinkphp 的 isAjax 一直为false
原因:axios 请求头中没有带X-Requested-With 这个参数。解决办法:给请求头添加X-Requested-With 这个参数,参数值为XMLHttpRequest// 以 axios 为例this.$axios.get('http://yourdomain.com/api/getMenus', { headers: {'X-Requested...原创 2019-04-21 02:28:33 · 1233 阅读 · 0 评论 -
让 axios 请求接口时带上cookie
import Vue from 'vue'import axios from 'axios'// 让 axios 请求接口时带上cookieaxios.defaults.withCredentials = true;Vue.prototype.$axios = axios;...原创 2019-05-14 18:31:29 · 3019 阅读 · 0 评论