Vue踩坑

axios then 使用箭头函数

this.$axios({
					method:'post',
					url:'api/sign-up',
					responseType:'json',
					data:{
						user:this.modelRegist.user,
						password:this.modelRegist.password,
						rePassword:this.modelRegist.repeatPassword
					},
					timeout:5000,
				}).then( (response) =>{

vuetify 使用fontawesome的问题,推荐跑vuefity的教程而不是fa的教程

vue的this指针域问题

v-img src不能使用相对路径

<v-img :src="require('../../assets/logo.png')" />

vue router path顺序问题

vueJs 部署问题

https://cloud.tencent.com/developer/news/119838

npm run build

修改 /usr/local/nginx/conf 目录下找到的 nginx.conf 文件

location 的位置改一下,定位到dist就可以了

v-data-table 单选变成所有都选时

item-key = "name"

router

path:'',name:Cloud,component:Cloud,alias:'cloud'
path 和 alias的问题

vue原型挂载要在new Vue之前

var signState ={
    isSign:false
};
Vue.prototype.$axios = axios;    //全局注册,使用方法为:this.$axios
Vue.prototype.$signState = signState;

// axios.defaults.baseURL = 'http://106.52.138.50/';
axios.defaults.baseURL = 'http://10.203.248.251:8000/';

new Vue({
  render: h => h(App),vuetify,router
}).$mount('#app');
  • router钩子方法要在Vue.use(Router)之前

axios 返回值问题

async await

axios then方法异步

assgin

Object.assign

一般用于修改现有的条目

vuex

getters函数使用不能有括号

事件总线

每次创建手动清除事件,箭头函数

created() {
			this.$bus.$off("onAvatarClicked");
		},
		
		mounted() {
			this.$bus.$on("onAvatarClicked",()=>{
				this.openThemeSettings();
			})
		}

vue tify file input 单选时v-model自动成为file类型,而不是file[]

axios发送表单时

withCredentials:true,
contentType:"multipart/form-data",

回车后刷新问题

@submit.native.prevent
在表单处使用
原文地址:https://www.cnblogs.com/granx/p/11727240.html