|
|
@@ -1,23 +1,52 @@
|
|
|
<template>
|
|
|
- <a-select :class="prefixCls" v-model:value="text" :options="OPTIONS" @change="handleMenuClick"> </a-select>
|
|
|
+ <div :class="prefixCls" :style="{ width: `${vertical ? buttonWidth : buttonWidth * 2 + 10}px` }">
|
|
|
+ <a-button
|
|
|
+ :class="{ 'select-button': true, primary: isBaseHome }"
|
|
|
+ :style="{ width: `${buttonWidth}px` }"
|
|
|
+ @click="handleMenuClick(PageEnum.BASE_HOME)"
|
|
|
+ >
|
|
|
+ {{ t('routes.basic.baseHome') }}
|
|
|
+ </a-button>
|
|
|
+ <a-button
|
|
|
+ :class="{ 'select-button': true, primary: !isBaseHome }"
|
|
|
+ :style="{ width: `${buttonWidth}px` }"
|
|
|
+ @click="handleMenuClick(PageEnum.SECONDARY_HOME)"
|
|
|
+ >
|
|
|
+ {{ t('routes.basic.secondaryHome') }}
|
|
|
+ </a-button>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
// import { Button, Dropdown, Menu, MenuItem } from 'ant-design-vue';
|
|
|
// import { DownOutlined } from '@ant-design/icons-vue';
|
|
|
import { useDesign } from '/@/hooks/web/useDesign';
|
|
|
- import { ref } from 'vue';
|
|
|
+ import { computed, ref } from 'vue';
|
|
|
import { PageEnum } from '/@/enums/pageEnum';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
|
|
|
- const { prefixCls } = useDesign('system-select');
|
|
|
+ const props = withDefaults(
|
|
|
+ defineProps<{
|
|
|
+ vertical?: boolean;
|
|
|
+ buttonWidth?: number;
|
|
|
+ }>(),
|
|
|
+ {
|
|
|
+ vertical: false,
|
|
|
+ buttonWidth: 210,
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ const { prefixCls: precls } = useDesign('system-select');
|
|
|
+ const prefixCls = computed(() => {
|
|
|
+ return props.vertical ? `${precls}-vertical w-${props.buttonWidth}px` : `${precls} w-${props.buttonWidth * 2}px`;
|
|
|
+ });
|
|
|
const router = useRouter();
|
|
|
const { t } = useI18n();
|
|
|
|
|
|
// 由于BASE_HOME仅代表了一个页面,其他页面都隶属于SECONDARY_HOME,所以简单处理
|
|
|
const isBaseHome = router.currentRoute.value.path === PageEnum.BASE_HOME;
|
|
|
- const text = ref(isBaseHome ? PageEnum.BASE_HOME : PageEnum.SECONDARY_HOME);
|
|
|
+ // const text = ref(isBaseHome ? PageEnum.BASE_HOME : PageEnum.SECONDARY_HOME);
|
|
|
|
|
|
function handleMenuClick(value) {
|
|
|
router.push({ path: value });
|
|
|
@@ -44,25 +73,45 @@
|
|
|
@prefix-cls: ~'@{namespace}-system-select';
|
|
|
|
|
|
.@{prefix-cls} {
|
|
|
- max-width: 210px;
|
|
|
- width: 100%;
|
|
|
- min-width: 10px;
|
|
|
- margin-bottom: 10px;
|
|
|
+ // margin-bottom: 10px;
|
|
|
position: relative;
|
|
|
z-index: @layout-basic-z-index;
|
|
|
- }
|
|
|
|
|
|
- .@{prefix-cls}.ant-select {
|
|
|
- :deep(.ant-select-selector) {
|
|
|
+ .select-button {
|
|
|
+ height: @multiple-height;
|
|
|
+ }
|
|
|
+
|
|
|
+ .primary {
|
|
|
+ border-color: @primary-color;
|
|
|
background-color: @primary-color;
|
|
|
+ color: @white;
|
|
|
+ }
|
|
|
+ .select-button:nth-child(1) {
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .@{prefix-cls}-vertical {
|
|
|
+ // margin-bottom: 10px;
|
|
|
+ position: relative;
|
|
|
+ z-index: @layout-basic-z-index;
|
|
|
|
|
|
- .ant-select-selection-item {
|
|
|
- color: @white;
|
|
|
- }
|
|
|
+ .select-button {
|
|
|
+ height: @multiple-height;
|
|
|
}
|
|
|
|
|
|
- :deep(.ant-select-arrow) {
|
|
|
+ .primary {
|
|
|
+ border-color: @primary-color;
|
|
|
+ background-color: @primary-color;
|
|
|
color: @white;
|
|
|
}
|
|
|
+
|
|
|
+ .select-button:nth-child(1) {
|
|
|
+ border-radius: 0px;
|
|
|
+ border-top-left-radius: 10px;
|
|
|
+ }
|
|
|
+ .select-button:nth-child(2) {
|
|
|
+ border-radius: 0px;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|