{"id":1174,"date":"2024-11-21T11:13:20","date_gmt":"2024-11-21T03:13:20","guid":{"rendered":"http:\/\/www.max-shu.com\/blog\/?p=1174"},"modified":"2024-11-21T11:13:21","modified_gmt":"2024-11-21T03:13:21","slug":"vue%e5%89%8d%e7%ab%af%e5%a2%9e%e5%8a%a0%e5%9b%bd%e9%99%85%e5%8c%96%e6%94%af%e6%8c%81","status":"publish","type":"post","link":"http:\/\/www.max-shu.com\/blog\/?p=1174","title":{"rendered":"VUE\u524d\u7aef\u589e\u52a0\u56fd\u9645\u5316\u652f\u6301"},"content":{"rendered":"\n<p><strong>\u5b89\u88c5vue\u7684i18\uff1a<\/strong><\/p>\n\n\n\n<p>npm install vue-i18n@latest &#8211;save<\/p>\n\n\n\n<p><strong>\u5728main.js\u4e2d\u589e\u52a0i18n\u7684\u652f\u6301\uff1a<\/strong><\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color has-link-color wp-elements-c973e1c6cf77c64589e3e227446e0f59\">import i18n from &#8220;@\/i18n&#8221;;<\/p>\n\n\n\n<p>const app = createApp(App)<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color has-link-color wp-elements-80a4e8ef22985248f67c88c7aefb23b0\">app.use(i18n);<\/p>\n\n\n\n<p>app.mount(&#8216;#app&#8217;)<\/p>\n\n\n\n<p><strong>\u5728stores\u91cc\u9762\u589e\u52a0LanguageStore.ts\uff1a<\/strong><\/p>\n\n\n\n<p>import { defineStore } from &#8216;pinia&#8217;;<\/p>\n\n\n\n<p>import zhCn from &#8216;element-plus\/dist\/locale\/zh-cn.mjs&#8217;<\/p>\n\n\n\n<p>import zhTw from &#8216;element-plus\/dist\/locale\/zh-tw.mjs&#8217;<\/p>\n\n\n\n<p>import en from &#8216;element-plus\/dist\/locale\/en.mjs&#8217;<\/p>\n\n\n\n<p>\/\/ \u521b\u5efa Pinia Store<\/p>\n\n\n\n<p>export const languageStore = defineStore(&#8216;languageStore&#8217;, {<\/p>\n\n\n\n<p>&nbsp; \/\/i18n\u63d0\u4f9b\u81ea\u5199\u4ee3\u7801\u56fd\u9645\u5316\uff0cel-config-provider\u63d0\u4f9belement plus\u7684\u56fd\u9645\u5316\u3002\u4ee5languageStore\u6700\u4e3a\u5a92\u4ecb\uff0c\u628a\u4e24\u8005\u5173\u8054\u8d77\u6765<\/p>\n\n\n\n<p>&nbsp; state: () =&gt; {<\/p>\n\n\n\n<p>&nbsp; &nbsp; return {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; language: sessionStorage.getItem(&#8220;localeLang&#8221;) || &#8220;zhCn&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; languageElement: zhCn,<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; },<\/p>\n\n\n\n<p>&nbsp; actions:{<\/p>\n\n\n\n<p>&nbsp; &nbsp; initElementLanguage(){<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; switch(this.language){<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; case &#8220;zhCn&#8221;: this.languageElement = zhCn; break;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; case &#8220;zhTw&#8221;: this.languageElement = zhTw; break;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; case &#8220;en&#8221;: &nbsp; this.languageElement = en; break;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; &nbsp; },<\/p>\n\n\n\n<p>&nbsp; &nbsp; languageChange(value: string){<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; this.language = value<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; sessionStorage.setItem(&#8220;localeLang&#8221;, value)<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; },<\/p>\n\n\n\n<p>});<\/p>\n\n\n\n<p>export type State = {<\/p>\n\n\n\n<p>&nbsp; &nbsp; language: string;<\/p>\n\n\n\n<p>};<\/p>\n\n\n\n<p>export const state: State = {<\/p>\n\n\n\n<p>&nbsp; &nbsp; language: sessionStorage.getItem(&#8220;localeLang&#8221;) || &#8220;zhCn&#8221;,<\/p>\n\n\n\n<p>};<\/p>\n\n\n\n<p><strong>\u5728App.vue\u4e2d\u589e\u52a0\uff1a<\/strong><\/p>\n\n\n\n<p>&nbsp; import {languageStore} from &#8216;@\/stores\/LanguageStore&#8217;<\/p>\n\n\n\n<p>&nbsp; let store = languageStore()<\/p>\n\n\n\n<p>&nbsp; store.initElementLanguage()<\/p>\n\n\n\n<p>&nbsp; const language = ref(store.languageElement);<\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p>&lt;template&gt;<\/p>\n\n\n\n<p>&lt;el-config-provider :locale=&#8221;language&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp; &lt;div id=&#8221;appRoute&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &lt;RouterView v-slot=&#8221;{ Component }&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &lt;!&#8211; &lt;transition&gt; &#8211;&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;keep-alive&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;component :is=&#8221;Component&#8221; v-if=&#8221;$route.meta.keepAlive&#8221;\/&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;\/keep-alive&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;component :is=&#8221;Component&#8221; v-if=&#8221;!$route.meta.keepAlive&#8221;&gt;&lt;\/component&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &lt;!&#8211; &lt;\/transition&gt; &#8211;&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &lt;\/RouterView&gt;<\/p>\n\n\n\n<p>&nbsp; &lt;\/div&gt;<\/p>\n\n\n\n<p>&lt;\/el-config-provider&gt; &nbsp;<\/p>\n\n\n\n<p>&lt;\/template&gt;<\/p>\n\n\n\n<p><strong>\u5728src\u76ee\u5f55\u4e0b\u5efa\u7acbi18n\u76ee\u5f55\uff0c\u7136\u540e\u5efa\u7acbindex.ts\u6587\u4ef6\uff1a<\/strong><\/p>\n\n\n\n<p>import { createI18n } from &#8220;vue-i18n&#8221;;<\/p>\n\n\n\n<p>import zhCn from &#8220;.\/language\/zh-cn&#8221;;<\/p>\n\n\n\n<p>import zhTw from &#8220;.\/language\/zh-tw&#8221;;<\/p>\n\n\n\n<p>import en from &#8220;.\/language\/en&#8221;;<\/p>\n\n\n\n<p>const i18n = createI18n({<\/p>\n\n\n\n<p>&nbsp; &nbsp; locale: sessionStorage.getItem(&#8220;localeLang&#8221;) || &#8220;zhCn&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; messages: {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; zhCn,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; zhTw,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; en,<\/p>\n\n\n\n<p>&nbsp; &nbsp; },<\/p>\n\n\n\n<p>});<\/p>\n\n\n\n<p>export default i18n;<\/p>\n\n\n\n<p><strong>\u7136\u540e\u518di18n\u76ee\u5f55\u4e0b\u5efa\u7acb\u5404\u79cd\u8bed\u8a00\u7684\u7ffb\u8bd1\u6587\u4ef6\uff0c\u6bd4\u5982en.ts\uff1a<\/strong><\/p>\n\n\n\n<p>export default {<\/p>\n\n\n\n<p>&nbsp; &nbsp; XianGuoZhi_TW: {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; selectProducts: &#8220;Please select products: &#8220;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; selectPayChannel: &#8220;Please select pay channel: &#8220;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; purchase: &#8220;PURCHASE&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; ok: &#8220;OK&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; userId: &#8220;USER ID: &#8220;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; inputUserId: &#8220;Please input your user id in game: &#8220;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; placeholderUserId: &#8220;Please input&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; titleUserId: &#8220;Input User ID&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; },<\/p>\n\n\n\n<p>};<\/p>\n\n\n\n<p><strong>\u6bd4\u5982zh-cn.ts\uff1a<\/strong><\/p>\n\n\n\n<p>export default {<\/p>\n\n\n\n<p>&nbsp; &nbsp; XianGuoZhi_TW: {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; selectProducts: &#8220;\u8bf7\u9009\u62e9\u5546\u54c1\uff1a&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; selectPayChannel: &#8220;\u8bf7\u9009\u62e9\u652f\u4ed8\u901a\u9053\uff1a&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; purchase: &#8220;\u8d2d\u4e70&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; ok: &#8220;\u786e\u5b9a&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; userId: &#8220;\u7528\u6237ID\uff1a&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; inputUserId: &#8220;\u8bf7\u8f93\u5165\u60a8\u5728\u6e38\u620f\u4e2d\u7684\u7528\u6237ID\uff1a&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; placeholderUserId: &#8220;\u8bf7\u8f93\u5165&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; titleUserId: &#8220;\u8f93\u5165\u7528\u6237ID&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; },<\/p>\n\n\n\n<p>};<\/p>\n\n\n\n<p><strong>\u53c8\u6bd4\u5982zh-tw.ts\uff1a<\/strong><\/p>\n\n\n\n<p>export default {<\/p>\n\n\n\n<p>&nbsp; &nbsp; XianGuoZhi_TW: {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; selectProducts: &#8220;\u8acb\u9078\u64c7\u5546\u54c1\uff1a&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; selectPayChannel: &#8220;\u8acb\u9078\u64c7\u652f\u4ed8\u901a\u9053\uff1a&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; purchase: &#8220;\u8cfc\u8cb7&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; ok: &#8220;\u78ba\u5b9a&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; userId: &#8220;\u7528\u6236ID\uff1a&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; inputUserId: &#8220;\u8acb\u8f38\u5165\u60a8\u5728\u904a\u6232\u4e2d\u7684\u7528\u6236ID\uff1a&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; placeholderUserId: &#8220;\u8acb\u8f38\u5165&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; titleUserId: &#8220;\u8f38\u5165\u7528\u6236ID&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; },<\/p>\n\n\n\n<p>};<\/p>\n\n\n\n<p><strong>\u7136\u540e\u518d\u9700\u8981\u56fd\u9645\u5316\u7684vue\u6587\u4ef6\u4e2d\uff1a<\/strong><\/p>\n\n\n\n<p>\u6ce8\u610f\uff1ai18n\u4f7f\u7528\u65f6\u7528t(x)\u51fd\u6570\uff08js\u91cc\u9762\u7528\uff09\u6216\u8005$t(x)\u51fd\u6570\uff08html\u91cc\u9762\u7528\uff09\u6765\u7ffb\u8bd1\u5bf9\u5e94\u7684\u8bed\u8a00\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; import {languageStore} from &#8216;@\/stores\/LanguageStore&#8217;<\/p>\n\n\n\n<p>&nbsp; &nbsp; let langStore = languageStore()<\/p>\n\n\n\n<p>&nbsp; &nbsp; import { useI18n } from &#8216;vue-i18n&#8217;<\/p>\n\n\n\n<p>&nbsp; &nbsp; const { t, locale } = useI18n()<\/p>\n\n\n\n<p>&nbsp; &nbsp; const placeholderUserId = ref(t(&#8220;XianGuoZhi_TW.placeholderUserId&#8221;))<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color has-link-color wp-elements-0596aa7e44f43311970e9cf847d201cb\">&nbsp; &nbsp; const titleUserId = ref(t(&#8220;XianGuoZhi_TW.titleUserId&#8221;))<\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p>&lt;template&gt;<\/p>\n\n\n\n<p class=\"has-luminous-vivid-orange-color has-text-color has-link-color wp-elements-83f2ee89bce1b047f58081fa45fc77b3\">\u00a0 &lt;Header>&lt;\/Header> &lt;!&#8211; \u7528\u6765\u9009\u62e9\u8bed\u8a00\u7684\u5934\u90e8\u7ec4\u4ef6\uff0c\u89c1\u4e0b\u9762 &#8211;><\/p>\n\n\n\n<p>&nbsp; &nbsp; &lt;div&gt;<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color has-link-color wp-elements-6b7bc20a8ac8c9395db7fe45ffa2a9cf\">&nbsp; &nbsp; &nbsp; &nbsp; {{ $t(&#8220;XianGuoZhi_TW.selectProducts&#8221;) }}<\/p>\n\n\n\n<p>&nbsp; &nbsp; &lt;\/div&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &lt;div&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;ul style=&#8221;list-style-type:none;&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color has-link-color wp-elements-8e17ae65a119e5a5f16efcce5f09c8d6\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ $t(&#8220;XianGuoZhi_TW.userId&#8221;) }}<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color has-link-color wp-elements-cb9df5ad0cfbeb2d4c0bbb907eb1cce3\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;el-input v-model=&#8221;userIdInput&#8221; style=&#8221;width: 240px&#8221; :placeholder=&#8221;placeholderUserId&#8221; size=&#8221;large&#8221; \/&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;\/li&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;\/ul&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &lt;\/div&gt;<\/p>\n\n\n\n<p>&lt;\/template><\/p>\n\n\n\n<p><strong>\u7528\u6765\u9009\u62e9\u8bed\u8a00\u7684Header.vue\u7ec4\u4ef6\uff1a<\/strong><\/p>\n\n\n\n<p>&lt;script lang=&#8221;ts&#8221; setup name=&#8221;Header&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; import {onMounted, onBeforeMount, ref, getCurrentInstance} from &#8220;vue&#8221;<\/p>\n\n\n\n<p>&nbsp; &nbsp; import { useI18n } from &#8220;vue-i18n&#8221;;<\/p>\n\n\n\n<p>&nbsp; &nbsp; import {languageStore} from &#8216;@\/stores\/LanguageStore&#8217;<\/p>\n\n\n\n<p>&nbsp; &nbsp; \/\/i18n\u63d0\u4f9b\u81ea\u5199\u4ee3\u7801\u56fd\u9645\u5316\uff0cel-config-provider\u63d0\u4f9belement plus\u7684\u56fd\u9645\u5316\u3002\u4ee5languageStore\u6700\u4e3a\u5a92\u4ecb\uff0c\u628a\u4e24\u8005\u5173\u8054\u8d77\u6765<\/p>\n\n\n\n<p>&nbsp; &nbsp; let store = languageStore()<\/p>\n\n\n\n<p>&nbsp; &nbsp; const { locale } = useI18n();<\/p>\n\n\n\n<p>&nbsp; &nbsp; const langType = {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &#8220;zhCn&#8221;: &#8220;\u7b80\u4f53&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &#8220;zhTw&#8221;: &#8220;\u7e41\u9ad4&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &#8220;en&#8221;: &nbsp; &#8220;English&#8221;,<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; &nbsp; const handleCommand = (value: string) =&gt; {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; locale.value = value;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; store.languageChange(value);<\/p>\n\n\n\n<p>&nbsp; &nbsp; };<\/p>\n\n\n\n<p>&lt;\/script&gt;<\/p>\n\n\n\n<p>&lt;template&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &lt;div class=&#8221;header&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &lt;el-dropdown @command=&#8221;handleCommand&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;span class=&#8221;el-dropdown-link&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ langType[store.language] }}<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;el-icon class=&#8221;el-icon&#8211;right&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;arrow-down \/&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;\/el-icon&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;\/span&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;template #dropdown&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;el-dropdown-menu&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;el-dropdown-item command=&#8221;zhCn&#8221;&gt;{{ langType[&#8216;zhCn&#8217;] }}&lt;\/el-dropdown-item&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;el-dropdown-item command=&#8221;zhTw&#8221;&gt;{{ langType[&#8216;zhTw&#8217;] }}&lt;\/el-dropdown-item&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;el-dropdown-item command=&#8221;en&#8221;&gt;{{ langType[&#8216;en&#8217;] }}&lt;\/el-dropdown-item&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;\/el-dropdown-menu&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;\/template&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &lt;\/el-dropdown&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &lt;\/div&gt;<\/p>\n\n\n\n<p>&lt;\/template&gt;<\/p>\n\n\n\n<p>&lt;style lang=&#8221;less&#8221;&gt;<\/p>\n\n\n\n<p>&nbsp; &nbsp; .header {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; display: flex;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; align-items: center;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; justify-content: space-between;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; width: 100%;<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>&lt;\/style&gt;<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5vue\u7684i18\uff1a npm install vue-i18n@latest &#8211;save \u5728mai &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[916,914,898,915,917],"class_list":["post-1174","post","type-post","status-publish","format-standard","hentry","category-13","tag-element-plus","tag-i18","tag-vue","tag-915","tag-917"],"views":813,"_links":{"self":[{"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1174"}],"version-history":[{"count":1,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1174\/revisions"}],"predecessor-version":[{"id":1175,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1174\/revisions\/1175"}],"wp:attachment":[{"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1174"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-shu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}