complete partition button active

This commit is contained in:
KUN1007 2023-06-10 01:57:53 +08:00
parent 4466d6ed8f
commit 614d152c49
6 changed files with 61 additions and 15 deletions

View file

@ -42,7 +42,7 @@ const handleConfirm = () => {
<div v-if="props.show" class="mask"> <div v-if="props.show" class="mask">
<div class="container"> <div class="container">
<div class="header"> <div class="header">
<h3>{{ alert?.info }}</h3> <h3>{{ $t(`${alert?.info}`) }}</h3>
</div> </div>
<div class="footer"> <div class="footer">

View file

@ -41,7 +41,7 @@ const emit = defineEmits(['update'])
appear appear
> >
<div class="lass"> <div class="lass">
<span>{{ name + $t('') }}</span> <span>{{ name }}</span>
</div> </div>
</Transition> </Transition>
<div class="avatar"> <div class="avatar">
@ -52,7 +52,7 @@ const emit = defineEmits(['update'])
appear appear
> >
<!-- 啊哈哈哈想不到吧这里参考的是糖调写的 --> <!-- 啊哈哈哈想不到吧这里参考的是糖调写的 -->
<div class="info">{{ `${info?.info}` }}</div> <div class="info">{{ `${$t(`${info?.info}`)}` }}</div>
</Transition> </Transition>
<div class="close" @click="emit('update', false)"> <div class="close" @click="emit('update', false)">
<Icon icon="line-md:close" /> <Icon icon="line-md:close" />

View file

@ -111,4 +111,8 @@ export default {
confirm: 'OK', confirm: 'OK',
cancel: 'Cancel', cancel: 'Cancel',
}, },
AlertInfo: {
publish: 'Confirm to publish?',
draft: 'The draft has been saved successfully!',
},
} }

View file

@ -111,4 +111,8 @@ export default {
confirm: '确定', confirm: '确定',
cancel: '取消', cancel: '取消',
}, },
AlertInfo: {
publish: '确认发布吗?',
draft: '草稿已经保存成功!',
},
} }

View file

@ -1 +0,0 @@

View file

@ -3,7 +3,7 @@ import KUNGalgameAlert from '@/components/KUNGalgameAlert/KUNGalgameAlert.vue'
import { props } from '@/components/KUNGalgameAlert/types' import { props } from '@/components/KUNGalgameAlert/types'
import { provide } from 'vue' import { type Ref, provide, ref } from 'vue'
// //
const getAlertValue = (value: boolean) => { const getAlertValue = (value: boolean) => {
@ -12,18 +12,44 @@ const getAlertValue = (value: boolean) => {
} }
const alert: props = { const alert: props = {
info: '确认发布吗', info: 'AlertInfo.publish',
isShowCancel: true, isShowCancel: true,
status: getAlertValue, status: getAlertValue,
} }
const info: props = { const info: props = {
info: '草稿已经保存成功!', info: 'AlertInfo.draft',
isShowCancel: true, isShowCancel: true,
} }
provide('alert', alert) provide('alert', alert)
provide('info', info) provide('info', info)
interface Button {
index: number
name: string
isActive: Ref<boolean>
}
const button: Button[] = [
{
index: 1,
name: 'galgame',
isActive: ref(false),
},
{
index: 2,
name: '技术交流',
isActive: ref(false),
},
{
index: 3,
name: '其它',
isActive: ref(false),
},
]
const buttonStatus = ref(false)
</script> </script>
<template> <template>
@ -31,10 +57,16 @@ provide('info', info)
<div class="topic-group"> <div class="topic-group">
<div>点击选择帖子的分区可多选:</div> <div>点击选择帖子的分区可多选:</div>
<!-- 分类容器的按钮集合 --> <!-- 分类容器的按钮集合 -->
<div class="group-btn"> <div class="group-btn" :class="buttonStatus ? 'selected-btn' : ''">
<button>galgame</button> <button
<button>技术交流</button> class="btn"
<button>其它</button> v-for="kun in button"
:key="kun.index"
@click="kun.isActive.value = !kun.isActive.value"
:class="{ active: kun.isActive.value }"
>
{{ kun.name }}
</button>
</div> </div>
</div> </div>
<!-- 按钮的容器 --> <!-- 按钮的容器 -->
@ -65,14 +97,14 @@ provide('info', info)
margin: 20px 0; margin: 20px 0;
} }
/* 单个按钮的样式 */ /* 单个按钮的样式 */
.group-btn > button { .btn {
height: 30px; height: 30px;
width: 20%; width: 20%;
font-size: 17px; font-size: 17px;
cursor: pointer; cursor: pointer;
border: 1px solid var(--kungalgame-purple-4); border: 1px solid var(--kungalgame-blue-1);
background-color: var(--kungalgame-trans-purple-1); background-color: var(--kungalgame-trans-blue-0);
color: var(--kungalgame-purple-4); color: var(--kungalgame-blue-4);
} }
/* 按钮的容器 */ /* 按钮的容器 */
.btn-container { .btn-container {
@ -120,4 +152,11 @@ provide('info', info)
background-color: var(--kungalgame-orange-2); background-color: var(--kungalgame-orange-2);
transform: scale(0.8); transform: scale(0.8);
} }
/* 被选中按钮的样式 */
.active {
transition: 0.2s;
background-color: var(--kungalgame-blue-4);
color: var(--kungalgame-white);
}
</style> </style>