当我告诉它它是一个道具时,我试图找出为什么我的js文件中未定义的未定义。
<checklist :uncheckable="true" type="permit" project="{{ $roofingProject->id }}"></checklist>
组件:
<input :disabled="isDisabled(item)" type="checkbox" v-model="item.isCompleted" v-on:change="completeChecklistItem(index, item)" /> <i class="fa fa-check-circle-o text-success" aria-hidden="true" v-if="item.isCompleted"></i><i class="fa fa-times-circle-o text-danger" aria-hidden="true" v-else></i> <span>{{ item.content }}</span>
<script>
module.exports = {
http: {
headers: {
'X-CSRF-TOKEN': window.Laravel.csrfToken
}
},
props: ['type', 'project', 'uncheckable'],
data: function(){
return { items: [] };
},
methods: {
isDisabled: function (item) {
return !uncheckable && item.isCompleted
}
}
}
</script>
答案 0 :(得分:1)
您忘记在this
方法
isDisabled(){}
更改
return !uncheckable && item.isCompleted
到
return !this.uncheckable && item.isCompleted