vue/valid-next-tick
强制执行有效的
nextTick
函数调用
- ⚙️ 此规则包含在所有
"plugin:vue/vue3-essential"
、*.configs["flat/essential"]
、"plugin:vue/essential"
、*.configs["flat/vue2-essential"]
、"plugin:vue/vue3-strongly-recommended"
、*.configs["flat/strongly-recommended"]
、"plugin:vue/strongly-recommended"
、*.configs["flat/vue2-strongly-recommended"]
、"plugin:vue/vue3-recommended"
、*.configs["flat/recommended"]
、"plugin:vue/recommended"
和*.configs["flat/vue2-recommended"]
中。 - 🔧 命令行 上的
--fix
选项可以自动修复此规则报告的一些问题。 - 💡 此规则报告的一些问题可以通过编辑器 建议 手动修复。
📖 规则详情
调用 Vue.nextTick
或 vm.$nextTick
时,如果没有传递回调函数并且没有等待返回的 Promise,则很可能是一个错误(可能是缺少 await
)。
正在加载...
🔧 选项
无。
📚 进一步阅读
- Vue 2 中的
Vue.nextTick
API - Vue 2 中的
vm.$nextTick
API - 全局 API Tree-shaking
- Vue 3 中的全局
nextTick
API - Vue 3 中的实例
$nextTick
API
🚀 版本
此规则是在 eslint-plugin-vue v7.5.0 中引入的。