解决 vue axios 带 header 时,会默认发起 OPTIONS 请求的方法的问题

This commit is contained in:
YunaiV
2019-03-27 19:12:12 +08:00
parent 42b11e377e
commit c23eb737f0
10 changed files with 182 additions and 17 deletions

View File

@@ -82,21 +82,32 @@
</template>
<script>
import { GetUserIndex } from "../../api/user.js";
// import { GetUserIndex } from "../../api/user.js";
import { getAccessToken } from '../../utils/cache.js';
import { getUserInfo } from '../../api/user.js';
export default {
data(){
return{
data:{}
data: {},
user: {},
}
},
components: {
},
created:function(){
GetUserIndex().then(response=>{
this.data=response;
});
// GetUserIndex().then(response=>{
// this.data=response;
// });
},
mounted() {
if (getAccessToken()) { // 存在
let response = getUserInfo();
response.then(data => {
this.user = data;
});
}
}
};
</script>

View File

@@ -3,10 +3,10 @@
<headerNav title="账号管理"/>
<van-cell-group>
<van-cell title="修改个人信息" is-link />
<van-cell title="修改登录密码" is-link />
<van-cell title="修改绑定手机" is-link />
<van-cell title="关联账号" is-link />
<van-cell title="切换账号" is-link to="/login" />
<!--<van-cell title="修改登录密码" is-link />-->
<!--<van-cell title="修改绑定手机" is-link />-->
<!--<van-cell title="关联账号" is-link />-->
<!--<van-cell title="切换账号" is-link to="/login" />-->
</van-cell-group>
</div>
</template>
@@ -19,4 +19,4 @@ export default {
<style>
</style>
</style>