这与 Laravel 5.4 及其 Passport 密码授予有关。
\n\n我有获取 access_token 供用户使用的路线,效果完全正常。
\n\n如果当前访问令牌过期,我还有一个刷新令牌的路线。
\n\n当我使用 Postman 到达路线时
\n\nhttp://192.168.10.10/refresh\nRun Code Online (Sandbox Code Playgroud)\n\n我得到这个有效的返回:
\n\n"data": {\n "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOi...deleting most of it.",\n "expires_in": 600\n}\nRun Code Online (Sandbox Code Playgroud)\n\n但是,当我通过浏览器点击路由时,通过以下代码使用 axios:
\n\nlet headers = { \'Content-type\': \'application/json\' }\nreturn axios.post("http://192.168.10.10/refresh", {headers: headers}).then(res => {\n if (res) return res;\n }).catch(err => {\n if (err) return err.response;\n });\nRun Code Online (Sandbox Code Playgroud)\n\n我收到 HTTP 500 错误状态代码。
\n\n我也在跟踪 laravel 日志中的错误,这是堆栈跟踪。
\n\n[2017-08-30 07:21:41] local.ERROR:GuzzleHttp\\Exception\\ClientException:客户端错误:POST http://192.168.10.10/oauth/token导致400 Bad Request响应:\n{"error":"invalid_request","message":"请求缺少必需的参数,包括无效的参数值,(被截断...)\n 在 /home/vagrant/Code/work/vendorgraphs-api/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 …
我有一个PhoneCard.vue组件,我正试图传递道具.
<template>
<div class='phone-number-card'>
<div class='number-card-header'>
<h4 class="number-card-header-text">{{ cardData.phone_number }}</h4>
<span class="number-card-subheader">
{{ cardData.username }}
</span>
</div>
</div>
</template>
<script>
export default {
props: ['userData'],
components: {
},
data() {
return {
cardData: {}
}
},
methods: {
setCardData() {
this.cardData = this.userData;
console.log(this.cardData);
}
},
watch: {
userData() {
this.setCardData();
}
}
}
Run Code Online (Sandbox Code Playgroud)
组件接收userData的属性,然后将其设置为组件的cardData属性.
我有另一个Vue.js组件,我将其用作页面.在这个页面上,我正在向api发出一个AJAX调用,以获取一个数字和用户列表.
import PhoneCard from './../../global/PhoneCard.vue';
export default {
components: {
'phone-card': PhoneCard
},
data() {
return {
phoneNumbers: [],
}
},
methods: {
fetchActiveNumbers() { …Run Code Online (Sandbox Code Playgroud) 有什么方法可以设置VS代码格式化程序来格式化Angular 2+模板中的组件,以将属性换行。我希望它是这种格式:
<app
[input1]="input1$ | async"
[input2]="input2$ | async"
(inputChanged)="setInput(input)">
</app>
Run Code Online (Sandbox Code Playgroud)
对我们来说,启用自动格式化并以这种方式格式化将是很好的。React在下一行中包装JSX属性并对齐它们具有类似的功能。