标签:app1 script 存储 url order login npm use exp
一、安装、引入axios
1、终端输入cnpm install axios
2、在main.js中引入 import axios from ‘axios’
3、配置路径
axios.defaults.baseURL = ‘https://order-app1.firebaseio.com/’
二、在register组件中写登陆方法
1、现在script中导入axios
<script> import axios from ‘axios‘ export default { data(){ return{ email:‘‘, password:‘‘, confirmPassword:‘‘ } }, methods:{ onSubmit(){ if(this.password === this.confirmPassword){ const formData = { email:this.email, password:this.password, confirmPassword:this.confirmPassword } axios.post(‘/users.json‘,formData) .then(res => this.$router.push({ name:‘loginLink‘//直接跳转到登陆界面 }))//console.log(res) }else{ alert("两次密码不一致!") } } } } </script>
标签:app1 script 存储 url order login npm use exp
原文地址:https://www.cnblogs.com/JimShi/p/11208103.html