You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In versions before 3.5 where `useTemplateRef()`was not introduced, we need to declare a ref with a name that matches the template ref attribute's value. The ref should also contain an array value:
Copy file name to clipboardExpand all lines: src/guide/reusability/custom-directives.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ const vHighlight = {
31
31
32
32
```vue
33
33
<script setup>
34
-
// enables v-highlight in templates
34
+
// 在模板中启用 v-highlight
35
35
const vHighlight = {
36
36
mounted: (el) => {
37
37
el.classList.add('is-highlight')
@@ -55,7 +55,7 @@ const highlight = {
55
55
56
56
exportdefault {
57
57
directives: {
58
-
//enables v-highlight in template
58
+
//在模板中启用 v-highlight
59
59
highlight
60
60
}
61
61
}
@@ -73,17 +73,17 @@ export default {
73
73
74
74
<divclass="composition-api">
75
75
76
-
In`<script setup>`, any camelCase variable that starts with the `v`prefix can be used as a custom directive. In the example above, `vHighlight`can be used in the template as `v-highlight`.
Similar to components, custom directives must be registered so that they can be used in templates. In the example above, we are using local registration via the `directives`option.
Copy file name to clipboardExpand all lines: src/guide/reusability/plugins.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -136,6 +136,6 @@ export default {
136
136
137
137
</div>
138
138
139
-
### Bundle for NPM
139
+
### 为 NPM 打包
140
140
141
-
If you further want to build and publish your plugin for others to use, see [Vite's section on Library Mode](https://vitejs.dev/guide/build.html#library-mode).
0 commit comments