Skip to content

Commit

Permalink
Merge pull request #298 from Mr-BeanSir/main
Browse files Browse the repository at this point in the history
修复封装state时忘记修改html导致的报错
  • Loading branch information
jekip authored Oct 21, 2024
2 parents f729a5b + b88c047 commit cc2a911
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 46 deletions.
84 changes: 43 additions & 41 deletions src/views/setting/account/account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class="thing-cell"
v-for="item in typeTabList"
:key="item.key"
:class="{ 'thing-cell-on': type === item.key }"
:class="{ 'thing-cell-on': state.type === item.key }"
@click="switchType(item)"
>
<template #header>{{ item.name }}</template>
Expand All @@ -16,61 +16,63 @@
</n-card>
</n-grid-item>
<n-grid-item span="18">
<n-card :bordered="false" size="small" :title="typeTitle" class="proCard">
<BasicSetting v-if="type === 1" />
<SafetySetting v-if="type === 2" />
<n-card :bordered="false" size="small" :title="state.typeTitle" class="proCard">
<BasicSetting v-if="state.type === 1" />
<SafetySetting v-if="state.type === 2" />
</n-card>
</n-grid-item>
</n-grid>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import BasicSetting from './BasicSetting.vue';
import SafetySetting from './SafetySetting.vue';
import { reactive, ref } from 'vue';
import BasicSetting from './BasicSetting.vue';
import SafetySetting from './SafetySetting.vue';
const typeTabList = [
{
name: '基本设置',
desc: '个人账户信息设置',
key: 1,
},
{
name: '安全设置',
desc: '密码,邮箱等设置',
key: 2,
},
];
const typeTabList = [
{
name: '基本设置',
desc: '个人账户信息设置',
key: 1,
},
{
name: '安全设置',
desc: '密码,邮箱等设置',
key: 2,
},
];
const type = ref(1);
const typeTitle = ref('基本设置');
const state = reactive({
type: 1,
typeTitle: '基本设置',
});
function switchType(e) {
type.value = e.key;
typeTitle.value = e.name;
}
function switchType(e) {
state.type = e.key;
state.typeTitle = e.name;
}
</script>
<style lang="less" scoped>
.thing-cell {
margin: 0 -16px 10px;
padding: 5px 16px;
.thing-cell {
margin: 0 -16px 10px;
padding: 5px 16px;
&:hover {
background: #f3f3f3;
cursor: pointer;
}
&:hover {
background: #f3f3f3;
cursor: pointer;
}
}
.thing-cell-on {
background: #f0faff;
color: #2d8cf0;
.thing-cell-on {
background: #f0faff;
color: #2d8cf0;
::v-deep(.n-thing-main .n-thing-header .n-thing-header__title) {
color: #2d8cf0;
}
::v-deep(.n-thing-main .n-thing-header .n-thing-header__title) {
color: #2d8cf0;
}
&:hover {
background: #f0faff;
}
&:hover {
background: #f0faff;
}
}
</style>
10 changes: 5 additions & 5 deletions src/views/setting/system/system.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class="thing-cell"
v-for="item in typeTabList"
:key="item.key"
:class="{ 'thing-cell-on': type === item.key }"
:class="{ 'thing-cell-on': state.type === item.key }"
@click="switchType(item)"
>
<template #header>{{ item.name }}</template>
Expand All @@ -16,10 +16,10 @@
</n-card>
</n-grid-item>
<n-grid-item span="18">
<n-card :bordered="false" size="small" :title="typeTitle" class="proCard">
<BasicSetting v-if="type === 1" />
<RevealSetting v-if="type === 2" />
<EmailSetting v-if="type === 3" />
<n-card :bordered="false" size="small" :title="state.typeTitle" class="proCard">
<BasicSetting v-if="state.type === 1" />
<RevealSetting v-if="state.type === 2" />
<EmailSetting v-if="state.type === 3" />
</n-card>
</n-grid-item>
</n-grid>
Expand Down

0 comments on commit cc2a911

Please sign in to comment.