這應(yīng)該很容易,但我找不到我做錯了什么。僅當(dāng)檢查所有復(fù)選框時,才應(yīng)啟用該按鈕,但是更改并未傳播。事實上 buttonDisabled 只在開始時被調(diào)用一次。會喜歡一個答案和一些關(guān)于如何調(diào)試它的技巧。<template> <f7-page name="home"> <f7-list inset> <f7-list-item title="I've got my headphones on"> <f7-checkbox slot="media" :checked="checked.headphones"></f7-checkbox> </f7-list-item> <f7-list-item title="I have 10 minutes to myself"> <f7-checkbox slot="media" :checked="checked.time"></f7-checkbox> </f7-list-item> <f7-list-item title="I'm in a quiet space"> <f7-checkbox slot="media" :checked="checked.quiet"></f7-checkbox> </f7-list-item> </f7-list> <f7-list inset> <f7-button :disabled="buttonDisabled" fill round>Let's get started</f7-button> </f7-list> </f7-page></template><script> export default { data: function() { return { checked: { headphones: false, time: false, quiet: false, } } }, computed: { buttonDisabled() { return ! ( this.checked.headphones && this.checked.time && this.checked.quiet ); } } }</script>
為什么我的計算屬性沒有在 Vue 中更新?
汪汪一只貓
2022-12-22 15:59:19