Skip to content

vue/return-in-computed-property ​

强制在计算属性中存在 return 语句

  • ⚙️ 此规则包含在 "plugin:vue/essential"、*.configs["flat/essential"]、"plugin:vue/vue2-essential"、*.configs["flat/vue2-essential"]、"plugin:vue/strongly-recommended"、*.configs["flat/strongly-recommended"]、"plugin:vue/vue2-strongly-recommended"、*.configs["flat/vue2-strongly-recommended"]、"plugin:vue/recommended"、*.configs["flat/recommended"]、"plugin:vue/vue2-recommended" 和 *.configs["flat/vue2-recommended"] 中。

📖 规则详情 ​

此规则强制 computed 属性和函数中存在 return 语句。

¥This rule enforces that a return statement is present in computed properties and functions.

Now loading...
Now loading...

🔧选项 ​

¥🔧 Options

json
{
  "vue/return-in-computed-property": ["error", {
    "treatUndefinedAsUnspecified": true
  }]
}

此规则有一个对象选项:

¥This rule has an object option:

  • "treatUndefinedAsUnspecified":true(默认)不允许使用 return 语句隐式返回 undefined。

    ¥"treatUndefinedAsUnspecified": true (default) disallows implicitly returning undefined with a return statement.

treatUndefinedAsUnspecified: false ​

Now loading...

🚀版本 ​

¥🚀 Version

此规则在 eslint-plugin-vue v3.7.0 中引入

¥This rule was introduced in eslint-plugin-vue v3.7.0

🔍代码实现 ​

¥🔍 Implementation

eslint-plugin-vue v10.4 中文网 - 粤ICP备13048890号