问题
I have a get request that detects if user is Admin or not.
My problem is that I want to display a button using v-if
to check if it's true or false. By default the value is set to false
.
Data
Then we got the button :
And the .then
in beforeCreate
:
回答1:
You need to use an arrow function to preserve the this
context:
.then((responses) => {
Otherwise the callback function injects its own this
来源:https://stackoverflow.com/questions/65290912/type-error-in-then-function-using-vue-js