Skip to content

vue/next-tick-style

nextTick 中强制使用 Promise 或回调样式

  • 🔧 command line 上的 --fix 选项可以自动修复此规则报告的一些问题。

📖 规则详情

此规则强制在 Vue.nextTickthis.$nextTick 中是否应使用回调版本或 Promise 版本(在 Vue v2.1.0 中引入)。

¥This rule enforces whether the callback version or Promise version (which was introduced in Vue v2.1.0) should be used in Vue.nextTick and this.$nextTick.

Now loading...

🔧选项

¥🔧 Options

默认值设置为 promise

¥Default is set to promise.

json
{
  "vue/next-tick-style": ["error", "promise" | "callback"]
}
  • "promise"(默认)...需要使用 promise 版本。

    ¥"promise" (default) ... requires using the promise version.

  • "callback" ...要求使用回调版本。如果你使用的 Vue 版本低于 v2.1.0,请使用此项。

    ¥"callback" ... requires using the callback version. Use this if you use a Vue version below v2.1.0.

"callback"

Now loading...

📚扩展阅读

¥📚 Further Reading

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v7.5.0 中引入

¥This rule was introduced in eslint-plugin-vue v7.5.0

🔍代码实现

¥🔍 Implementation

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