集成 vue-i18n 支持国际化

This commit is contained in:
就眠儀式
2022-02-09 17:40:33 +08:00
parent 4325ca3bff
commit 70d4f66b96
7 changed files with 62 additions and 7 deletions

View File

@@ -6,6 +6,9 @@ export default {
<script setup lang="ts">
import "./index.less"
import { useI18n } from 'vue-i18n'
const { t } = useI18n();
export interface LayInputProps {
name?: string;
@@ -15,7 +18,8 @@ export interface LayInputProps {
placeholder?: string;
}
const props = defineProps<LayInputProps>();
const props = withDefaults(defineProps<LayInputProps>(), {
});
const emit = defineEmits(["update:modelValue", "input", "focus", "blur"]);

View File

@@ -6,6 +6,7 @@ export default {
<script setup lang="ts">
import { Ref, ref, watch, useSlots, computed } from "vue";
import { useI18n } from 'vue-i18n';
export interface LayPageProps {
total: number;
@@ -23,6 +24,8 @@ export interface LayPageProps {
const slots = useSlots();
const { t } = useI18n();
const props = withDefaults(defineProps<LayPageProps>(), {
limit: 10,
theme: "green",
@@ -113,7 +116,7 @@ watch(currentPage, function () {
@click="prev()"
>
<slot v-if="slots.prev" name="prev"></slot>
<template v-else>上一页</template>
<template v-else>{{ t('page.prev') }}</template>
</a>
<template v-if="showPage">
<template v-for="index of totalPage" :key="index">
@@ -135,7 +138,7 @@ watch(currentPage, function () {
@click="next()"
>
<slot v-if="slots.next" name="next"></slot>
<template v-else>下一页</template>
<template v-else>{{ t('page.next') }}</template>
</a>
<span v-if="showLimit" class="layui-laypage-limits">
<select v-model="inlimit">