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

中国风优秀个人网站欣赏seo网页的基础知识

中国风优秀个人网站欣赏,seo网页的基础知识,做网站 学什么,视频制作软件排行榜前十前言 之前做项目过程中,也做过一次多语言切换,大致思想都是一样的,想了解的可以看下之前的文章C#WinForm实现多语言切换 使用i18n插件 安装插件 npm install vue-i18n --saveMain.js配置 // 引入 多语言包 import VueI18n from vue-i18n…

前言

之前做项目过程中,也做过一次多语言切换,大致思想都是一样的,想了解的可以看下之前的文章C#WinForm实现多语言切换

使用i18n插件

安装插件
npm install vue-i18n --save
Main.js配置
// 引入 多语言包
import VueI18n from 'vue-i18n'
Vue.use(VueI18n) // 通过插件的形式挂载
// 引入语言包,注意路径
import Chinese from '@/common/lang/cn.js'; //简体中文
import English from '@/common/lang/en.js'; //英文
import Deutsch from '@/common/lang/gd.js'; //德文// 构造i18n对象
const i18n = new VueI18n({// 默认语言,这里的local属性,对应message中的cn、en属性locale: uni.getStorageSync('locale') || 'zh_CN',// 引入语言文件messages: {// 这里的属性名是任意的,您也可以把zh设置为cn等,只是后续切换语言时// 要标识这里的语言属性,如:this.$i18n.locale = zh|en|cn|xxx'zh_CN': Chinese,'en_US': English,'de-DE':Deutsch}
})Vue.prototype._i18n = i18n;
语言文件

在COMMON下创建个文件夹,然后把语言文件放到这个下面,可以看到上述配置引用的语言文件
在这里插入图片描述

//语言文件写法
export default {login: {title:'WMS',zhanghao:'账号',mima:'密码',qingshuruzhanghao:'请输入账号'},userdetail:{fanhui:'返回',xuanze:'语言选择'}
}
语言切换

首先看下效果图:
在这里插入图片描述
页面实现代码放下面了,注意的是切换的时候不是切换这一个页面,是所有配置好的页面都会切换。

<template><view class="content"><scroll-view scroll-y class="page"><cu-custom bgColor="bg-gradual-pink" :isBack="true"><block slot="backText">{{$t('userdetail.fanhui')}}</block><block slot="content">{{$t('userdetail.xuanze')}}</block></cu-custom><view class="radioInfo"><view class="dataInfo"><!-- 列表内容开始 --><radio-group @change="radioChange"><view class="dataList" v-for="(item,index) in dataList" :key='index'@click="listClick(item.titleId)" :class="index === radioCurrent?'radiOn':''"><view class="textImg"><view class="img"><image :src="item.imgUrl" mode="widthFix"></image></view><view class="text"><text>{{item.title}}</text><text>{{item.url}}</text></view></view><view class="radioBox"><radio color="#2DCF8C" :value="item.titleId + ''" :checked="index === radioCurrent" /></view></view></radio-group><!-- 列表内容结束 --></view></view>	</scroll-view></view>
</template><script>import api from '@/api/api.js'export default {data() {return {dataList: [{imgUrl: '../../static/icon/cn.png',title: '中文',titleId: 1}, {imgUrl: '../../static/icon/vn.png',title: 'English',titleId: 2}, {imgUrl: '../../static/icon/dg.png',title: 'Deutsch',titleId: 3}],radioCurrent: null,dataFrom: {titleId: null //传的id}};},methods: {radioChange(evt) { //单个选择框点击this.dataFrom.titleId = parseInt(evt.detail.value) //如果需要通过点击来知道选择的是哪个商品的idconsole.log('选中',this.dataFrom.titleId)if(this.dataFrom.titleId == 1){this._i18n.locale = "zh_CN"}if(this.dataFrom.titleId == 2){this._i18n.locale = "en_US"}if(this.dataFrom.titleId == 3){this._i18n.locale = "de-DE"}},listClick(titleId) { //整个数据点击this.dataFrom.titleId = titleId //如果需要通过点击来知道选择的是哪个商品的idfor (let i = 0; i < this.dataList.length; i++) {if (this.dataList[i].titleId == titleId) {this.radioCurrent = i;break;}}}	}}
</script><style>.page {height: 100Vh;width: 100vw;}.page.show {overflow: hidden;}.switch-sex::after {content: "\e716";}.switch-sex::before {content: "\e7a9";}.switch-music::after {content: "\e66a";}.switch-music::before {content: "\e6db";}
</style>
<style lang="scss">.content {.radioInfo {.dataInfo {width: 80%;margin: auto;.checkAll {display: flex;justify-content: space-between;}.radiOn {border: 1px solid #2DCF8C !important;}.dataList {width: 170%;display: flex;align-items: center;justify-content: space-between;border: 1px solid #E7E9EE;padding: 20rpx;margin-bottom: 20rpx;.textImg {display: flex;align-items: center;.img {border: 1px solid #E7E9EE;padding: 10rpx;image {width: 90rpx;height: 90rpx;display: block;}}.text {padding-left: 20rpx;text {display: block;font-size: 30rpx;color: #000;font-weight: bold;}}}}}}}
</style>
http://www.ds6.com.cn/news/102977.html

相关文章:

  • 萝岗区营销型网站建设bt兔子磁力搜索
  • 帮别人做网站要投资吗百度信息流推广是什么意思
  • 湛江专业建站推荐广告优化师工作内容
  • 太原市做网站百度关键词点击器
  • 武汉网站建设不推广网页设计基础
  • 淘宝客网站怎么做seo新东方
  • 南宁建站服务引流客户的最快方法是什么
  • 天津网站建设工具网站seo怎么操作
  • 网站开发框架是什么网站开发用什么软件
  • 怎么提交公司网站成人职业培训学校
  • 电商网站建设目标分析的方法免费b2b推广网站
  • 青海省建设厅勘察设计备案网站谷歌官网网址
  • 珠海网站建设公司有哪些游戏推广怎么做挣钱
  • 做金融服务网站赚钱整站优化系统厂家
  • 凡科网登录管理系统广州网站优化费用
  • 专门做油站数据的网站百度seo排名主要看啥
  • wordpress 验证码插件安徽seo优化规则
  • 多网合一网站如何优化
  • 郴州市委书记重庆seo杨洋
  • 有什的自学做网站百度导航最新版本下载安装
  • 济南公积金网站不收费推广网站有哪些
  • 兰州北山生态建设局网站营销策划主要做些什么
  • wetest网站开发怎样推广自己的广告
  • 网站 cmsseo外链是什么意思
  • 阿里云服务器如何用IP做网站网页自动点击软件
  • 制作公司网页软件进行优化
  • 每个网站都有后台吗直播网站排名
  • 做直播的网站爱站长尾词挖掘工具
  • 全国疫情最新资讯seo网站推广目的
  • 网站说服力 营销型网站策划 下载西安百度推广优化托管