0
我的页面上有一个按钮,点击时获取禁用属性和aria-disabled =“true”。但是,当页面重新加载按钮并不保持禁用,即使我传递布尔真值为is。我添加了一个警告,并由于某种原因,即使buttonStat为真我得到一个错误的值。Laravel Vue JS按钮不会停留在重定向
控制器
public function syncOrders() {
return redirect('/orders')->with(compact('orders'))->with('buttonState', true);
}
查看
<sync-button v-cloak :active="{{ json_encode($buttonState) }}"></sync-button>
JS
<template>
<button class="btn btn-primary" style="margin:5px;"
:disabled="isDisabled" :aria-disabled="isDisabled"
@click="sync">Sync Orders</button></template>
<script>
export default {
props: ['active', 'old'],
computed: {
isDisabled() {
return this.active;
}
},
methods: {
sync() {
this.active = ! this.active;
}
}
}
</script>