vue/return-in-computed-property Enforce that a return statement is present in computed property
此规则强制return语句在computed属性中得完整存在。<script>export default {computed: {/* ✓ GOOD */foo () {if (this.bar) {return this.baz} else {return this.baf...
·
此规则强制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>
更多推荐
已为社区贡献19条内容
所有评论(0)