提交 0b522120 编写于 作者: KK's avatar KK

组件重命名 && 代码格式化

上级 b7bb4b17
...@@ -123,7 +123,7 @@ export const AppComponents = { ...@@ -123,7 +123,7 @@ export const AppComponents = {
// 定制组件 // 定制组件
v.component('app-customize',() => import('@/ibiz-core/components/app-customize/app-customize.vue')); v.component('app-customize',() => import('@/ibiz-core/components/app-customize/app-customize.vue'));
// 主题切换组件 // 主题切换组件
v.component('app-mob-select-changeTheme',() => import('@/ibiz-core/components/app-mob-select-changeTheme/app-mob-select-changeTheme.vue')); v.component('app-mob-select-theme',() => import('@/ibiz-core/components/app-mob-select-theme/app-mob-select-theme.vue'));
// 锚点列表插件 // 锚点列表插件
v.component('app-anchor-list',() => import('@/components/app-anchor-list/app-anchor-list.vue')); v.component('app-anchor-list',() => import('@/components/app-anchor-list/app-anchor-list.vue'));
// 侧滑菜单组件 // 侧滑菜单组件
......
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
} }
} }
.theme { .app-mob-select-theme_theme {
display: flex; display: flex;
justify-content: end; justify-content: end;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
padding: 12px; padding: 12px;
} }
.theme_item { .app-mob-select-theme_theme_item {
width: 70px; width: 70px;
height: 70px; height: 70px;
border-radius: 50%; border-radius: 50%;
......
<template> <template>
<div class="app-mobile-theme"> <div class="app-mobile-theme">
<div class="activeoption" v-if="activeoption" :style="{'background':activeoption.background,'color':activeoption.color}">{{activeoption.text}}</div> <div class="activeoption" v-if="activeoption" :style="{'background':activeoption.background,'color':activeoption.color}">{{activeoption.text}}</div>
<van-action-sheet get-container="#app" v-model="show" :cancel-text="$t('app.button.cancel')" close-on-click-action> <van-action-sheet get-container="#app" :title="$t('themeSelection')" :closeable="false" v-model="show" :cancel-text="$t('app.button.cancel')" close-on-click-action>
<div class = "theme"> <div class = "app-mob-select-theme_theme">
<div @click="themeChange(item.value)" v-for="item in options" :key="item.value" class="theme_item" :style="{background:item.background,color:item.color}">{{item.text}}</div> <div @click="themeChange(item.value)" v-for="item in options" :key="item.value" class="app-mob-select-theme_theme_item" :style="{background:item.background,color:item.color}">{{item.text}}</div>
</div> </div>
</van-action-sheet> </van-action-sheet>
</div> </div>
...@@ -13,6 +13,16 @@ ...@@ -13,6 +13,16 @@
import { Vue, Component, Prop, Provide, Emit, Watch, } from "vue-property-decorator"; import { Vue, Component, Prop, Provide, Emit, Watch, } from "vue-property-decorator";
import { themeGroup } from './config' import { themeGroup } from './config'
@Component({ @Component({
i18n: {
messages: {
'ZH-CN': {
themeSelection: '主题选择',
},
'EN-US': {
themeSelection: 'Theme selection',
}
}
},
components: {}, components: {},
}) })
export default class AppSelectTheme extends Vue { export default class AppSelectTheme extends Vue {
...@@ -29,14 +39,14 @@ export default class AppSelectTheme extends Vue { ...@@ -29,14 +39,14 @@ export default class AppSelectTheme extends Vue {
* *
* @memberof AppSelectTheme * @memberof AppSelectTheme
*/ */
public activeoption:any = {}; public activeoption: any = {};
/** /**
* 获取当前主题 * 获取当前主题
* *
* @memberof AppSelectTheme * @memberof AppSelectTheme
*/ */
public getTheme(){ public getTheme() {
if (this.$router.app.$store.state.selectTheme) { if (this.$router.app.$store.state.selectTheme) {
return this.$router.app.$store.state.selectTheme; return this.$router.app.$store.state.selectTheme;
} else if (localStorage.getItem('theme-class')) { } else if (localStorage.getItem('theme-class')) {
...@@ -54,16 +64,6 @@ export default class AppSelectTheme extends Vue { ...@@ -54,16 +64,6 @@ export default class AppSelectTheme extends Vue {
*/ */
public options: any[] = themeGroup; public options: any[] = themeGroup;
/**
* 声明周期钩子
*
* @memberof AppSelectTheme
*/
public mounted() {
this.activeTheme = this.getTheme();
this.setActiveoption();
}
/** /**
* 激活主题 * 激活主题
* *
...@@ -76,12 +76,12 @@ export default class AppSelectTheme extends Vue { ...@@ -76,12 +76,12 @@ export default class AppSelectTheme extends Vue {
* *
* @memberof AppSelectTheme * @memberof AppSelectTheme
*/ */
public setActiveoption(){ public setActiveoption() {
let index = this.options.findIndex((item:any)=>{ let index = this.options.findIndex((item: any) => {
return this.activeTheme == item.value; return this.activeTheme == item.value;
}) })
this.activeoption = index>-1? this.options[index]:null; this.activeoption = index > -1 ? this.options[index] : null;
this.show = false; this.show = false;
} }
/** /**
...@@ -105,10 +105,19 @@ export default class AppSelectTheme extends Vue { ...@@ -105,10 +105,19 @@ export default class AppSelectTheme extends Vue {
* @param {*} val * @param {*} val
* @memberof AppTheme * @memberof AppTheme
*/ */
public open(){ public open() {
this.show = true; this.show = true;
} }
/**
* 声明周期钩子
*
* @memberof AppSelectTheme
*/
public mounted() {
this.activeTheme = this.getTheme();
this.setActiveoption();
}
} }
</script> </script>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
v-if="item.name !== 'theme' && item.name !== 'accountInformation'" v-if="item.name !== 'theme' && item.name !== 'accountInformation'"
name="chevron-forward-outline" name="chevron-forward-outline"
></ion-icon> ></ion-icon>
<app-mob-select-changeTheme v-if="item.name == 'theme'" ref="changeTheme"></app-mob-select-changeTheme> <app-mob-select-theme v-if="item.name == 'theme'" ref="changeTheme"></app-mob-select-theme>
<div <div
v-if="item.name == 'accountInformation'" v-if="item.name == 'accountInformation'"
class="content-list-item-content-text" class="content-list-item-content-text"
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
v-if="item.name !== 'theme' && item.name !== 'accountInformation'" v-if="item.name !== 'theme' && item.name !== 'accountInformation'"
name="chevron-forward-outline" name="chevron-forward-outline"
></ion-icon> ></ion-icon>
<app-mob-select-changeTheme v-if="item.name == 'theme'" ref="changeTheme"></app-mob-select-changeTheme> <app-mob-select-theme v-if="item.name == 'theme'" ref="changeTheme"></app-mob-select-theme>
<div <div
v-if="item.name == 'accountInformation'" v-if="item.name == 'accountInformation'"
class="content-list-item-content-text" class="content-list-item-content-text"
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
v-if="item.name !== 'theme' && item.name !== 'accountInformation'" v-if="item.name !== 'theme' && item.name !== 'accountInformation'"
name="chevron-forward-outline" name="chevron-forward-outline"
></ion-icon> ></ion-icon>
<app-mob-select-changeTheme v-if="item.name == 'theme'" ref="changeTheme"></app-mob-select-changeTheme> <app-mob-select-theme v-if="item.name == 'theme'" ref="changeTheme"></app-mob-select-theme>
<div <div
v-if="item.name == 'accountInformation'" v-if="item.name == 'accountInformation'"
class="content-list-item-content-text" class="content-list-item-content-text"
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册