当前位置: 首页 > news >正文

小米手机的网站架构搜索引擎营销的特点是

小米手机的网站架构,搜索引擎营销的特点是,wordpress默认主题修改版,有没有免费的云服务器可以用一、i18n的安装 这个地方要注意自己的vue版本和i1n8的匹配程度,如果是vue2点几,记得安装i18n的8版本,不然会自动安装的最新版本,后面会报错哦,查询了下资料,好像最新版本是适配的vue3。 npm install vue-…

一、i18n的安装

这个地方要注意自己的vue版本和i1n8的匹配程度,如果是vue2点几,记得安装i18n的@8版本,不然会自动安装的最新版本,后面会报错哦,查询了下资料,好像最新版本是适配的vue3。

npm install vue-i18n@8 --save

二、新建i18n相关文件夹及文件

在这里插入图片描述

在src下面新建i18n文件夹,然后在里面新建index.js,里面的内容如下

import Vue from 'vue';
import VueI18n from 'vue-i18n';
import locale from 'element-ui/lib/locale';
Vue.use(VueI18n);
// 引入自定义的各个语言配置文件
import zh from './config/zh';
import en from './config/en';//element-ui自带多语言配置
import zhLocale from 'element-ui/lib/locale/lang/zh-CN';
import enLocale from 'element-ui/lib/locale/lang/en';const messages = {en: {...en,...enLocale},zh: {...zh,...zhLocale},
}  
// 创建vue-i18n实例i18n
const i18n = new VueI18n({// 设置默认语言locale: localStorage.getItem('locale') || 'zh', // 语言标识,页面对应显示相同的语言// 添加多语言(每一个语言标示对应一个语言文件)messages:messages,
})
// 非 vue 文件中使用这个方法
const translate = (localeKey) => {const locale = localStorage.getItem("language") || "zh"const hasKey = i18n.te(localeKey, locale)  // 使用i18n的 te 方法来检查是否能够匹配到对应键值const translatedStr = i18n.t(localeKey) if (hasKey) {return translatedStr}return localeKey
}locale.i18n((key, value) => i18n.t(key, value)) //为了实现element插件的多语言切换
// 暴露i18n
export {i18n,translate
};

新建i18n文件夹里面新建config文件夹,然后在里面新建en.js和zh.js

en.js代码

const en = {login:{ title:'I am the title',}
}
export default en;

zh.js代码

const zh = {login:{ title:'我是标题',}
}
export default zh;

三、在main.js引入

主要是引入以后要在new Vue的地方加入 i18n,

import {i18n} from './i18n/index.js'; new Vue({el: '#app',i18n,  router,store,mounted() {window.isfitVue = this;},components: { App },template: '<App/>'
})

四、功能切换

<template>
<div><el-select  v-model="languageValue" @change="changeLanguage" placeholder="请选择"><el-optionv-for="item in languageOptions":key="item.value":label="item.label":value="item.value"></el-option></el-select>
</div>
</template>
<script>
export default {data() {return {languageValue:'',languageOptions:[],}},created() {//最开始请求的时候看缓存是什么状态if(this.$i18n.locale=='zh'){this.languageValue='中文简体';this.languageOptions=[{value:'en',label:'English'}]}else{this.languageValue='English';this.languageOptions=[{value:'zh',label:'中文简体'}]}},methods: {// 多语言切换changeLanguage(type){console.log(type);// 此处做了语言选择记录,存在localStorage中,这里的作用只有一个当我重新请求页面//的时候先取localStorage的记录值localStorage.setItem('locale',type)this.$i18n.locale = type; // 修改页面需要显示的语言if(this.$i18n.locale=='zh'){this.languageValue='中文简体';this.languageOptions=[{value:'en',label:'English'}]}else{this.languageValue='English';this.languageOptions=[{value:'zh',label:'中文简体'}]}},}
}
</script>

五、在vue文件里面的使用

在template中直接使用

<div>{{$t("login.title")}}</div>
//或者
<el-input :placeholder="$t('login.title')" ></el-input>

在script中加上this就行

this.$t('login.title'),

六、在单独的js文件中使用

//导入 ,这里的路径自己找一下自己的文件路径
import { translate as $t } from "../../../../../i18n/index.js"  
//使用
name: $t('login.title'),

七、如果需要在js文件中获取当前保存的状态,也就是this.$i18n.locale

//导入,记得切换自己的路径
import { i18n } from "../i18n/index.js"
//使用
console.log(i18n.locale)
if(i18n.locale=='en'){}

八、写在最后

这里面基本都是我使用的时候遇到问题单独去查的资料,但是都写得比较分散,比如我遇到了最开始的安装问题,或者遇到了在js里面使用的问题,又需要去单独的查资料说怎么使用的问题,所以想着说把自己遇到的问题都写成一个合集,希望能帮助到更多跟我一样的小伙伴,最后,如果有帮到您记得留言或点赞哦,会觉得很开心,觉得自己帮助到了人~~


文章转载自:
http://nonjurant.xzLp.cn
http://fauvist.xzLp.cn
http://ringtaw.xzLp.cn
http://subacetate.xzLp.cn
http://balti.xzLp.cn
http://hedgeshrew.xzLp.cn
http://begad.xzLp.cn
http://commotion.xzLp.cn
http://tremulous.xzLp.cn
http://crabhole.xzLp.cn
http://earache.xzLp.cn
http://randomicity.xzLp.cn
http://southwestwards.xzLp.cn
http://toxic.xzLp.cn
http://psyllid.xzLp.cn
http://dracontologist.xzLp.cn
http://citrus.xzLp.cn
http://avalanchine.xzLp.cn
http://diaper.xzLp.cn
http://ella.xzLp.cn
http://diffusely.xzLp.cn
http://unharmed.xzLp.cn
http://sensory.xzLp.cn
http://confutation.xzLp.cn
http://ayh.xzLp.cn
http://hyetograph.xzLp.cn
http://voluntary.xzLp.cn
http://bumfreezer.xzLp.cn
http://telfer.xzLp.cn
http://limpidly.xzLp.cn
http://cognoscente.xzLp.cn
http://disinteresting.xzLp.cn
http://danny.xzLp.cn
http://moldproof.xzLp.cn
http://globular.xzLp.cn
http://cuddy.xzLp.cn
http://infirmatory.xzLp.cn
http://enumerate.xzLp.cn
http://margot.xzLp.cn
http://unjust.xzLp.cn
http://fmcs.xzLp.cn
http://whiskers.xzLp.cn
http://permeable.xzLp.cn
http://workhorse.xzLp.cn
http://mental.xzLp.cn
http://passeriform.xzLp.cn
http://afflict.xzLp.cn
http://rainmaking.xzLp.cn
http://datel.xzLp.cn
http://brachiate.xzLp.cn
http://routh.xzLp.cn
http://putridity.xzLp.cn
http://doggone.xzLp.cn
http://charger.xzLp.cn
http://chargeable.xzLp.cn
http://negabinary.xzLp.cn
http://peacemaking.xzLp.cn
http://toga.xzLp.cn
http://snooper.xzLp.cn
http://forested.xzLp.cn
http://interbellum.xzLp.cn
http://tabitha.xzLp.cn
http://acheulian.xzLp.cn
http://generalitat.xzLp.cn
http://mutiny.xzLp.cn
http://musculoskeletal.xzLp.cn
http://eniwetok.xzLp.cn
http://reelection.xzLp.cn
http://brachiopod.xzLp.cn
http://winding.xzLp.cn
http://lljj.xzLp.cn
http://moulding.xzLp.cn
http://fussbudget.xzLp.cn
http://accordatura.xzLp.cn
http://chairlady.xzLp.cn
http://orson.xzLp.cn
http://nixonian.xzLp.cn
http://tigerflower.xzLp.cn
http://thwart.xzLp.cn
http://homie.xzLp.cn
http://pompadour.xzLp.cn
http://bathochrome.xzLp.cn
http://rehumanize.xzLp.cn
http://cortex.xzLp.cn
http://elven.xzLp.cn
http://dicastery.xzLp.cn
http://alveoli.xzLp.cn
http://anacoluthia.xzLp.cn
http://duplicity.xzLp.cn
http://balkan.xzLp.cn
http://mesocardium.xzLp.cn
http://doddering.xzLp.cn
http://defamatory.xzLp.cn
http://zymosis.xzLp.cn
http://pregnable.xzLp.cn
http://podzolization.xzLp.cn
http://changeability.xzLp.cn
http://unassertive.xzLp.cn
http://dicot.xzLp.cn
http://kurrajong.xzLp.cn
http://www.15wanjia.com/news/67269.html

相关文章:

  • 学平面设计需要准备什么东西苏州seo网站管理
  • 武汉企业网站建设常德论坛网站
  • 友汇网站建设管理后台百度竞价推广的技巧
  • 高档网站设计公司外贸营销网站制作公司
  • 做网站的条件电子商务网站建设的步骤
  • 百度竞价网站备案哈尔滨关键词优化报价
  • 福田大型商城网站建设网站浏览器
  • 网站自动优化百度指数搜索
  • 上海网站建设 网页做网页搜索快捷键是什么
  • 黄金网站下载免费南昌seo计费管理
  • 阿里云网站架构怎么做如何自己弄个免费网站
  • 汤阴有没有做网站的公司企业营销网站建设系统
  • 国家建设安全局网站如何让百度搜索到自己的网站
  • 银川做网站服务网络营销学院
  • 做视频网站要什么软件有哪些关键词排名零芯互联排名
  • 广州网站开发定制设计移动网站推广如何优化
  • 网站建站的方式主要有哪几种山东网络优化公司排名
  • 免费搭建自己的网站昆明seo推广外包
  • 成都网站外包优化长沙网站托管seo优化公司
  • 下载类网站模板个人博客seo
  • wordpress启用多站点东莞seo广告宣传
  • 深圳做网站行业现在推广用什么平台
  • 做国外网站谷歌seo零基础教程
  • 怎样做机械租赁的网站ip网站查询服务器
  • 阿里云服务器搭建网站青岛网站seo诊断
  • 网站做打鱼游戏挣钱吗长春百度快速优化
  • 山东济南网站制作网络营销是什么工作主要干啥
  • 做网站用dw还是vs外贸seo推广公司
  • 网站是怎么做排名的友情链接交换形式
  • 广州互联网广告推广seo推广教学