此规则强制return
语句在computed
属性中得完整存在。
<script>
export default {
computed: {
/* ✓ GOOD */
foo () {
if (this.bar) {
return this.baz
} else {
return this.baf
}
},
bar: function () {
return false
},
/* ✗ BAD */
baz () {
if (this.baf) {
return this.baf
}
},
baf: function () {}
}
}
</script>