Skip to content

Commit 8ddf76d

Browse files
committed
update
1 parent b90a81d commit 8ddf76d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

docs/@intlify/vue-i18n-extensions-api.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export declare function transformVTDirective(options?: TransformVTDirectiveOptio
2222

2323
| Parameter | Type | Description |
2424
| --- | --- | --- |
25-
| options | TransformVTDirectiveOptions | `v-t` custom directive transform options |
25+
| options | TransformVTDirectiveOptions | `v-t` custom directive transform options, see [TransformVTDirectiveOptions](#transformvtdirectiveoptions) |
2626

2727
#### Returns
2828

@@ -56,6 +56,19 @@ const i18n = createI18n({
5656
// get transform from `transformVTDirective` function, with `i18n` option
5757
const transformVT = transformVTDirective({ i18n })
5858

59+
const { code } = compile(`<p v-t="'hello'"></p>`, {
60+
mode: 'function',
61+
hoistStatic: true,
62+
prefixIdentifiers: true,
63+
directiveTransforms: { t: transformVT } // <- you need to specify to `directiveTransforms` option!
64+
})
65+
66+
console.log(code)
67+
// output ->
68+
// const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock } = Vue
69+
// return function render(_ctx, _cache) {
70+
// return (_openBlock(), _createBlock(\\"div\\", null, \\"こんにちは!\\"))
71+
// }
5972
```
6073

6174

@@ -101,7 +114,7 @@ mode?: I18nMode;
101114

102115
#### Remarks
103116

104-
Specify the mode of the API used by vue-i18n 'composable'
117+
Specify the API style of vue-i18n. If you use legacy API style (e.g. `$t`) at vue-i18n, you need to specify `legacy`. 'composable'
105118

106119

107120

0 commit comments

Comments
 (0)