Intlayer Vue Usage
Setup
useIntlayer Composable
<script setup>
import { useIntlayer } from "vue-intlayer";
const content = useIntlayer("my-dictionary-key");
console.log(content.title.raw); // Render as raw
</script>
<template>
<div>
<h1>
<!-- Render the visual editor -->
<content.title />
</h1>
<h1>
<!-- Render as string -->
{{ content.title }}
</h1>
<img :src="content.image.src" :alt="content.image.alt" />
</div>
</template>
Compiler
The Intlayer Compiler can extract all your content keys from your components, using one CLI command (npx intlayer extract) or automatically at app build.
It activates once compiler.enabled and compiler.output are set: .svelte files additionally require @intlayer/vue-compiler.
微信扫一扫