返回 Skill 列表
extension
分类: 开发与工程无需 API Key

intlayer-vue

将Intlayer国际化与Vue.js和Nuxt应用程序集成。当用户要求“设置Vue i18n”时,使用“useIntlayer”组合式,或在Vue组件中管理翻译。

person作者: jakexiaohubgithub

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>

Vue Documentation

References