在 vue 中将 false 触发为 true
trigger false to true in vue
我正在使用 laravel 5.6 并尝试将错误项设置为 true 以提交按钮微调器。
我的表单如下所示:
<template>
<form aria-label="Register" @submit.prevent="hit()">
<button type="submit" class="btn btn-primary">
<i class="fa fa-circle-o-notch fa-spin" v-if="spin"></i> Register
</button>
</template>
我添加了v-if="spin"
:
<script>
data(){
return{
spin:false
}
},
methods:{
hit(){
spin = true
}
</script>
没用!但是当我更改数据时:旋转为真。它默认保持旋转。
请帮帮我
spin
是您组件的成员,因此您需要从 this
:
访问它
methods:{
hit(){
this.spin = true
}
您必须设置 this
才能引用它:
`
methods:{
hit(){
this.spin = true
}
我正在使用 laravel 5.6 并尝试将错误项设置为 true 以提交按钮微调器。
我的表单如下所示:
<template>
<form aria-label="Register" @submit.prevent="hit()">
<button type="submit" class="btn btn-primary">
<i class="fa fa-circle-o-notch fa-spin" v-if="spin"></i> Register
</button>
</template>
我添加了v-if="spin"
:
<script>
data(){
return{
spin:false
}
},
methods:{
hit(){
spin = true
}
</script>
没用!但是当我更改数据时:旋转为真。它默认保持旋转。
请帮帮我
spin
是您组件的成员,因此您需要从 this
:
methods:{
hit(){
this.spin = true
}
您必须设置 this
才能引用它:
`
methods:{
hit(){
this.spin = true
}