Skip to content

vue/prefer-use-template-ref

要求模板引用使用 useTemplateRef 而不是 ref/shallowRef

¥require using useTemplateRef instead of ref/shallowRef for template refs

📖 规则详情

Vue 3.5 引入了一种通过 useTemplateRef() API 获取模板引用的新方法。

¥Vue 3.5 introduced a new way of obtaining template refs via the useTemplateRef() API.

此规则强制使用新的 useTemplateRef 函数而不是 ref/shallowRef 作为模板引用。

¥This rule enforces using the new useTemplateRef function instead of ref/shallowRef for template refs.

Now loading...

此规则跳过 ref 模板函数引用,因为这些引用应该用于允许自定义实现存储 ref。如果你更喜欢 useTemplateRef,则必须将模板 ref 的值更改为字符串。

¥This rule skips ref template function refs as these should be used to allow custom implementation of storing ref. If you prefer useTemplateRef, you have to change the value of the template ref to a string.

Now loading...

🔧选项

¥🔧 Options

无。

¥Nothing.

🚀版本

¥🚀 Version

此规则是在 eslint-plugin-vue v9.31.0 中引入的

¥This rule was introduced in eslint-plugin-vue v9.31.0

🔍代码实现

¥🔍 Implementation

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