1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <template>
- <view class="content">
- <view class="list">
- <view class="list-item flex" v-for="(item, index) in list" @click="change(item.type)">
- <view class="item-left">{{ item.name }}</view>
- <view class="item-right" v-if="language == item.type"><image src="../../static/img/gou.png" mode=""></image></view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- language: '',
- list: [{ name: '繁體中文', type: 'zh_tw' }, { name: 'English', type: 'en' },{name: '日本语',type: 'ja'},{name: '한국어',type: 'kor'}]
- };
- },
- onLoad() {
- let lang = uni.getStorageSync('lang');
- if (lang) {
- this.language = lang;
- }
- },
- onShow() {},
- methods: {
- change(type) {
- this._i18n.locale = type;
- this.language = type;
- uni.setStorageSync('lang', type);
- uni.switchTab({
- url: '/pages/index/index'
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page,
- .content {
- min-height: 100%;
- height: auto;
- background: #fff;
- }
- .list-item {
- padding: 40rpx 20rpx;
- .item-left {
- font-size: 36rpx;
- color: #707a8a;
- }
- .item-right {
- width: 36rpx;
- height: 36rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- </style>
|