Commit 7c606977 by lei

1

parent d0ad903e
<template> <template>
<NuxtPage></NuxtPage> <NuxtPage></NuxtPage>
</template> </template>
<script lang="ts" setup>
// window.devicePixelRatio--系统缩放比例
</script>
<style> <style>
@import '@/style/reset.css'; @import "@/style/reset.css";
@import 'tdesign-vue-next/es/style/index.css'; @import "tdesign-vue-next/es/style/index.css";
</style> </style>
<svg width="12" height="8" viewBox="0 0 12 8" fill="" xmlns="http://www.w3.org/2000/svg"> <svg width="12" height="8" viewBox="0 0 12 8" fill="" xmlns="http://www.w3.org/2000/svg">
<path d="M5.19212 0.732744C5.51188 0.350785 6.0992 0.350784 6.41896 0.732743L10.9846 6.18647C11.4205 6.7072 11.0503 7.5 10.3712 7.5H1.23991C0.560795 7.5 0.190556 6.7072 0.626488 6.18647L5.19212 0.732744Z" fill=""/> <path d="M0.228243 6.46246L5.36518 0.312312C5.71065 -0.104105 6.31146 -0.104105 6.64191 0.312312L11.7788 6.46246C12.2745 7.05505 11.884 8 11.133 8L0.859095 8C0.123101 8 -0.282447 7.05505 0.228243 6.46246Z" fill=""/>
</svg> </svg>
\ No newline at end of file
<svg width="12" height="8" viewBox="0 0 12 8" fill="" xmlns="http://www.w3.org/2000/svg"> <svg width="12" height="8" viewBox="0 0 12 8" fill="" xmlns="http://www.w3.org/2000/svg">
<path d="M6.86355 7.26726C6.54379 7.64922 5.95646 7.64922 5.6367 7.26726L1.07107 1.81353C0.635141 1.2928 1.00538 0.5 1.68449 0.5L10.8158 0.5C11.4949 0.5 11.8651 1.2928 11.4292 1.81353L6.86355 7.26726Z" fill=""/> <path d="M11.7718 1.53754L6.63482 7.68769C6.28935 8.1041 5.68854 8.1041 5.35809 7.68769L0.221155 1.53754C-0.274515 0.944945 0.116012 0 0.867027 0H11.1409C11.8769 0 12.2824 0.944945 11.7718 1.53754Z" fill=""/>
</svg> </svg>
\ No newline at end of file
@import './variables.less'; @import "./variables.less";
// layout rewrite // layout rewrite
.t-layout__sider { .t-layout__sider {
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
background-color: @brand-color; background-color: @brand-color;
.s-header { .s-header {
// width: 1280px;
.t-menu { .t-menu {
background-color: @brand-color; background-color: @brand-color;
color: #fff; color: #fff;
...@@ -107,7 +106,7 @@ ...@@ -107,7 +106,7 @@
font-weight: 500; font-weight: 500;
&::after { &::after {
content: ''; content: "";
position: absolute; position: absolute;
bottom: 0px; bottom: 0px;
height: 2px; height: 2px;
......
@import './default.css'; @import "./default.css";
@import './ui.css'; @import "./ui.css";
body { body {
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
html {
font-size: 14px;
}
@media screen and (max-width: 1550px) {
#__nuxt {
height: 100vh;
}
.t-layout {
zoom: 0.8;
height: 100%;
}
.t-layout .t-layout__content {
height: calc(100vh - 70px);
}
.home-wrapper {
width: 100% !important;
}
.token-page-wrapper {
flex: 1;
}
.filter-block-wrapper {
/* transform: scale(0.8);
transform-origin: 0 0;
height: 290px; */
}
/* 右侧 */
.home-wrapper .right-detail-wrapper {
/* transform: scale(0.8);
transform-origin: 0 0; */
width: 320px !important;
height: calc((100vh - 70px) * 1.25);
flex: none;
}
.right-detail-wrapper .details-title-box {
height: calc(100% - 40px);
display: flex;
flex-direction: column;
}
.right-body-scroll {
flex: 1;
}
.right-body-scroll .right-body {
}
}
...@@ -29,20 +29,20 @@ ...@@ -29,20 +29,20 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import LoginDropdown from './LoginDropdown.vue'; import LoginDropdown from "./LoginDropdown.vue";
import Foxwallet from './Foxwallet.vue'; import Foxwallet from "./Foxwallet.vue";
import Search from './Search.vue'; import Search from "./Search.vue";
import HomeLogo from '/public/images/svg/header/homeLogoLight.svg'; import HomeLogo from "/public/images/svg/header/homeLogoLight.svg";
import HomeLogo2 from '/public/images/svg/header/homeLogoDark.svg'; import HomeLogo2 from "/public/images/svg/header/homeLogoDark.svg";
import { tgUrl } from '@/utils/open'; import { tgUrl } from "@/utils/open";
const mode = useCurTheme(); const mode = useCurTheme();
const route = useRoute(); const route = useRoute();
</script> </script>
<style lang="less"> <style lang="less">
@import '../style/flex.less'; @import "../style/flex.less";
.s-header { .s-header {
height: 100%; height: 100%;
border-bottom: 1px solid var(--td-Search-info-border-bottom-2); border-bottom: var(--new-border-2);
background: var(--td--right-back-color-2); background: var(--td--right-back-color-2);
.t-menu { .t-menu {
background: var(--td--right-back-color-2); background: var(--td--right-back-color-2);
...@@ -59,7 +59,7 @@ const route = useRoute(); ...@@ -59,7 +59,7 @@ const route = useRoute();
text-decoration: none; text-decoration: none;
span { span {
padding-left: 10px; padding-left: 10px;
font-family: 'Medium'; font-family: "Medium";
} }
} }
:hover .home-logo { :hover .home-logo {
......
...@@ -17,11 +17,19 @@ ...@@ -17,11 +17,19 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import Header from './Header.vue'; import Header from "./Header.vue";
import Footer from './Footer.vue'; import Footer from "./Footer.vue";
const route = useRoute(); const route = useRoute();
</script> </script>
<style lang="less"> <style lang="less">
@import '@/style/layout.less'; @import "@/style/layout.less";
// @media screen and (max-width: 1550px) {
// .t-layout {
// transform: scale(0.9);
// width: 100%;
// height: 100%;
// transform-origin: 0 0;
// }
// }
</style> </style>
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
:currentPath="currentPath" :currentPath="currentPath"
:chat="tokenInfo.chat" :chat="tokenInfo.chat"
></token-social-list> ></token-social-list>
<submit-social-info></submit-social-info> <!-- <submit-social-info></submit-social-info> -->
<t-tabs <t-tabs
class="info-tabs" class="info-tabs"
v-model="currentTab" v-model="currentTab"
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
</div> </div>
<template v-if="CollectionOnload"> <template v-if="CollectionOnload">
<div v-show="defaBtn == 'collection'"> <div v-show="defaBtn == 'collection'">
<Collection></Collection> <!-- <Collection></Collection> -->
</div> </div>
</template> </template>
<template v-if="ifDetails"> <template v-if="ifDetails">
...@@ -108,23 +108,23 @@ ...@@ -108,23 +108,23 @@
</div> </div>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import request from '@/utils/request'; import request from "@/utils/request";
import { parsePercent, parseCoinAmount } from '@/utils/tool'; import { parsePercent, parseCoinAmount } from "@/utils/tool";
import TimeTab from './TimeTab.vue'; import TimeTab from "./TimeTab.vue";
import SecurityCheck from './SecurityCheck.vue'; import SecurityCheck from "./SecurityCheck.vue";
import TokenInfo from './TokenInfo.vue'; import TokenInfo from "./TokenInfo.vue";
import TokenPool from './TokenPool.vue'; import TokenPool from "./TokenPool.vue";
import TokenSocialList from './TokenSocialList.vue'; import TokenSocialList from "./TokenSocialList.vue";
import * as Cache from '@/utils/cache'; import * as Cache from "@/utils/cache";
import { MessagePlugin } from 'tdesign-vue-next'; import { MessagePlugin } from "tdesign-vue-next";
import DetailsEcharts from '../analysis/detailsEcharts.vue'; import DetailsEcharts from "../analysis/detailsEcharts.vue";
import Detailsicon from '/public/images/svg/rightDetail/detailsicon.svg'; import Detailsicon from "/public/images/svg/rightDetail/detailsicon.svg";
import Favo from '/public/images/svg/rightDetail/favo.svg'; import Favo from "/public/images/svg/rightDetail/favo.svg";
import CollectionSvg from '/public/images/svg/rightDetail/colection.svg'; import CollectionSvg from "/public/images/svg/rightDetail/colection.svg";
import { useI18n } from 'vue-i18n'; import { useI18n } from "vue-i18n";
import RightDetailHeader from './rightDetailHeader.vue'; import RightDetailHeader from "./rightDetailHeader.vue";
import SubmitSocialInfo from './SubmitSocialInfo'; import SubmitSocialInfo from "./SubmitSocialInfo";
import Collection from './collection'; import Collection from "./collection";
const router = useRouter(); const router = useRouter();
const { t, locale } = useI18n(); const { t, locale } = useI18n();
// 通知表格收藏图表取消收藏 // 通知表格收藏图表取消收藏
...@@ -133,16 +133,16 @@ const CollectionDe = CollectionDelete(); ...@@ -133,16 +133,16 @@ const CollectionDe = CollectionDelete();
// const initEchart = computed(() => store.getters['echart/gethasInit']); // const initEchart = computed(() => store.getters['echart/gethasInit']);
const headerBtns = computed(() => [ const headerBtns = computed(() => [
{ {
label: t('securityCheck.details'), label: t("securityCheck.details"),
value: 'details', value: "details",
}, },
{ {
label: t('filter.Collection'), label: t("filter.Collection"),
value: 'collection', value: "collection",
}, },
{ {
label: t('securityCheck.analysis'), label: t("securityCheck.analysis"),
value: 'echart', value: "echart",
}, },
]); ]);
const props = defineProps({ const props = defineProps({
...@@ -154,52 +154,52 @@ const props = defineProps({ ...@@ -154,52 +154,52 @@ const props = defineProps({
mt: String, mt: String,
up: Number, up: Number,
}); });
const emit = defineEmits(['update:setPool', 'SettwitterRul']); const emit = defineEmits(["update:setPool", "SettwitterRul"]);
const r24h = ref(''); const r24h = ref("");
const numR24h = ref(''); const numR24h = ref("");
// 收藏列表是否首次加载 // 收藏列表是否首次加载
const CollectionOnload = ref(false); const CollectionOnload = ref(false);
// 判断当前路由,隐藏右侧详情box中的折线图模块 // 判断当前路由,隐藏右侧详情box中的折线图模块
const currentRouter = router.currentRoute.value.name; const currentRouter = router.currentRoute.value.name;
const currentTab = ref('info'); const currentTab = ref("info");
const isInCollection = ref(false); const isInCollection = ref(false);
// 默认选择detail按钮 // 默认选择detail按钮
const defaBtn = ref('details'); const defaBtn = ref("details");
const ifDetails = ref(false); const ifDetails = ref(false);
const WatchEcharts = useWatchEcharts(); const WatchEcharts = useWatchEcharts();
// 传给详情折线图的tbname // 传给详情折线图的tbname
const tb = ref(''); const tb = ref("");
// 点击pool才加载 // 点击pool才加载
const isPool = ref(false); const isPool = ref(false);
const PoolAddress = ref(''); const PoolAddress = ref("");
// 当前链 // 当前链
const chain = useChain(); const chain = useChain();
const tokenInfo: any = ref({ const tokenInfo: any = ref({
avatar: '', avatar: "",
token: '', token: "",
pool: [], pool: [],
}); });
const getPriceRange = () => { const getPriceRange = () => {
const { up, r24h: proR24h } = props; const { up, r24h: proR24h } = props;
if ((proR24h + '')[0] == '-') { if ((proR24h + "")[0] == "-") {
// -,跌 // -,跌
let newR24h = parseFloat((proR24h + '').replace('-', '')); let newR24h = parseFloat((proR24h + "").replace("-", ""));
// 原价 // 原价
let oldPrice = props.up / (1 - newR24h); let oldPrice = props.up / (1 - newR24h);
numR24h.value = oldPrice - props.up; numR24h.value = oldPrice - props.up;
numR24h.value = '-' + parseCoinAmount(numR24h.value); numR24h.value = "-" + parseCoinAmount(numR24h.value);
} else if (proR24h == 0) { } else if (proR24h == 0) {
numR24h.value = '+0'; numR24h.value = "+0";
} else { } else {
// +,涨 // +,涨
// 原价 // 原价
let oldPrice = props.up / (proR24h + 1); let oldPrice = props.up / (proR24h + 1);
numR24h.value = props.up - oldPrice; numR24h.value = props.up - oldPrice;
numR24h.value = '+' + parseCoinAmount(numR24h.value); numR24h.value = "+" + parseCoinAmount(numR24h.value);
} }
r24h.value = parsePercent(proR24h + ''); r24h.value = parsePercent(proR24h + "");
if (r24h.value[0] !== '-') { if (r24h.value[0] !== "-") {
r24h.value = '+' + r24h.value; r24h.value = "+" + r24h.value;
} }
}; };
watch( watch(
...@@ -213,13 +213,13 @@ watch( ...@@ -213,13 +213,13 @@ watch(
watch( watch(
() => props.r24h, () => props.r24h,
(v) => { (v) => {
if (typeof v !== 'undefined') { if (typeof v !== "undefined") {
getPriceRange(); getPriceRange();
} }
} }
); );
const btnLoad = (value: string) => { const btnLoad = (value: string) => {
if (currentRouter == 'tokenAnalysis' && value == 'echart') { if (currentRouter == "tokenAnalysis" && value == "echart") {
return false; return false;
} }
return true; return true;
...@@ -235,7 +235,7 @@ watch( ...@@ -235,7 +235,7 @@ watch(
); );
// 流动池tab改变 // 流动池tab改变
const changeTab = (value) => { const changeTab = (value) => {
if (value === 'pool') { if (value === "pool") {
isPool.value = true; isPool.value = true;
} }
}; };
...@@ -249,31 +249,31 @@ const getTokenInfo = async () => { ...@@ -249,31 +249,31 @@ const getTokenInfo = async () => {
}, },
}); });
result.marketCap = parseFloat(result.supply * result.up + '').toFixed(1); result.marketCap = parseFloat(result.supply * result.up + "").toFixed(1);
result.tokenSub = ''; result.tokenSub = "";
if (result.token) { if (result.token) {
result.tokenSub = result.tokenSub =
result.token.substr(0, 6) + result.token.substr(0, 6) +
'...' + "..." +
result.token.substr(result.token.length - 4, 4); result.token.substr(result.token.length - 4, 4);
} }
// tbname-掩码 // tbname-掩码
result.tbnameSub = ''; result.tbnameSub = "";
result.n_tb = ''; result.n_tb = "";
if (props.tb) { if (props.tb) {
// 先将d去掉 // 先将d去掉
result.n_tb = result.n_tb =
props.tb[0] == 'd' ? props.tb.slice(1, props.tb.length) : props.tb; props.tb[0] == "d" ? props.tb.slice(1, props.tb.length) : props.tb;
result.tbnameSub = result.tbnameSub =
result.n_tb.substr(0, 6) + result.n_tb.substr(0, 6) +
'...' + "..." +
result.n_tb.substr(result.n_tb.length - 4, 4); result.n_tb.substr(result.n_tb.length - 4, 4);
} }
isInCollection.value = Cache.hasSet(props.tb); isInCollection.value = Cache.hasSet(props.tb);
Object.assign(tokenInfo.value, result); Object.assign(tokenInfo.value, result);
// 如果有推特链接,提交给twitter组件解析 // 如果有推特链接,提交给twitter组件解析
if ('chat' in result) { if ("chat" in result) {
emit('SettwitterRul', result.chat.twitter); emit("SettwitterRul", result.chat.twitter);
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e);
...@@ -283,7 +283,7 @@ const getTokenInfo = async () => { ...@@ -283,7 +283,7 @@ const getTokenInfo = async () => {
watch( watch(
() => locale.value, () => locale.value,
(v) => { (v) => {
if (defaBtn.value == 'echart') { if (defaBtn.value == "echart") {
WatchEcharts.value += 1; WatchEcharts.value += 1;
} }
} }
...@@ -291,16 +291,16 @@ watch( ...@@ -291,16 +291,16 @@ watch(
// 点击查看token详情信息 // 点击查看token详情信息
// v-if v-show同时使用,折线图第一次加载后,不在使用v-if,减少请求 // v-if v-show同时使用,折线图第一次加载后,不在使用v-if,减少请求
const gotoDetail = (value) => { const gotoDetail = (value) => {
if (value == 'collection' && !CollectionOnload.value) { if (value == "collection" && !CollectionOnload.value) {
CollectionOnload.value = true; CollectionOnload.value = true;
} }
// 先判断是否有token,没有则禁止打开折线图模块 // 先判断是否有token,没有则禁止打开折线图模块
if (!props.tb && value === 'echart') { if (!props.tb && value === "echart") {
MessagePlugin.closeAll(); MessagePlugin.closeAll();
MessagePlugin.warning(t('MessagePlugin.plToken')); MessagePlugin.warning(t("MessagePlugin.plToken"));
return; return;
} }
if (value === 'echart') { if (value === "echart") {
tb.value = props.tb; tb.value = props.tb;
ifDetails.value = true; ifDetails.value = true;
} }
...@@ -315,14 +315,14 @@ const monitor = computed((value) => { ...@@ -315,14 +315,14 @@ const monitor = computed((value) => {
// 接收右侧详情流动池address // 接收右侧详情流动池address
const changePool = (PoolValue) => { const changePool = (PoolValue) => {
PoolAddress.value = PoolValue; PoolAddress.value = PoolValue;
emit('update:setPool', PoolValue); emit("update:setPool", PoolValue);
}; };
watch( watch(
() => props.token, () => props.token,
(v) => { (v) => {
if (v) { if (v) {
//如果折线图为隐藏状态,需注销折线图模块 //如果折线图为隐藏状态,需注销折线图模块
if (defaBtn.value != 'echart') { if (defaBtn.value != "echart") {
ifDetails.value = false; ifDetails.value = false;
} }
tb.value = props.tb; tb.value = props.tb;
...@@ -332,8 +332,8 @@ watch( ...@@ -332,8 +332,8 @@ watch(
); );
</script> </script>
<style lang="less"> <style lang="less">
@import '@/style/flex.less'; @import "@/style/flex.less";
@import '@/style/variables.less'; @import "@/style/variables.less";
.right-detail-wrapper { .right-detail-wrapper {
height: calc(100vh - 70px); height: calc(100vh - 70px);
flex: 1; flex: 1;
...@@ -361,7 +361,7 @@ watch( ...@@ -361,7 +361,7 @@ watch(
font-size: 14px; font-size: 14px;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-family: 'Regular'; font-family: "Regular";
.details-icon-cl { .details-icon-cl {
width: 30px; width: 30px;
fill: var(--td-search-btn-back-1); fill: var(--td-search-btn-back-1);
...@@ -437,7 +437,7 @@ watch( ...@@ -437,7 +437,7 @@ watch(
border-bottom-left-radius: @border-radius; border-bottom-left-radius: @border-radius;
border-bottom-right-radius: @border-radius; border-bottom-right-radius: @border-radius;
.t-tabs__nav-item-text-wrapper { .t-tabs__nav-item-text-wrapper {
font-family: 'Medium'; font-family: "Medium";
} }
.t-tabs__header { .t-tabs__header {
background-color: var(--td--right-back-color-2); background-color: var(--td--right-back-color-2);
......
...@@ -27,27 +27,27 @@ const props = withDefaults( ...@@ -27,27 +27,27 @@ const props = withDefaults(
}>(), }>(),
{ {
options: [], options: [],
class: '', class: "",
margin: false, margin: false,
} }
); );
const emit = defineEmits(['update:modelValue', 'change']); const emit = defineEmits(["update:modelValue", "change"]);
const parentclass = ref(props.class); const parentclass = ref(props.class);
const currentBtn = ref(props.modelValue); const currentBtn = ref(props.modelValue);
const btnChange = (item: any) => { const btnChange = (item: any) => {
if (item.value == currentBtn.value) { if (item.value == currentBtn.value) {
currentBtn.value = ''; currentBtn.value = "";
} else { } else {
currentBtn.value = item.value; currentBtn.value = item.value;
} }
// 请求接口 // 请求接口
emit('update:modelValue', currentBtn.value); emit("update:modelValue", currentBtn.value);
emit('change', currentBtn.value); emit("change", currentBtn.value);
}; };
</script> </script>
<style lang="less"> <style lang="less">
@import '@/style/flex.less'; @import "@/style/flex.less";
.custom-filter-radio-box { .custom-filter-radio-box {
.da(); .da();
.filter-radio-button { .filter-radio-button {
...@@ -58,7 +58,7 @@ const btnChange = (item: any) => { ...@@ -58,7 +58,7 @@ const btnChange = (item: any) => {
width: 105px; width: 105px;
height: 24px; height: 24px;
line-height: 22px; line-height: 22px;
font-family: 'Regular'; font-family: "Regular";
cursor: pointer; cursor: pointer;
color: var(--td-Search-info-color-1); color: var(--td-Search-info-color-1);
.dja(); .dja();
...@@ -72,7 +72,7 @@ const btnChange = (item: any) => { ...@@ -72,7 +72,7 @@ const btnChange = (item: any) => {
background: var(--td--main-btn-color-1); background: var(--td--main-btn-color-1);
color: white; color: white;
font-weight: 500; font-weight: 500;
font-family: 'Medium'; font-family: "Medium";
&:hover { &:hover {
background: var(--td--main-btn-color-1); background: var(--td--main-btn-color-1);
color: white; color: white;
......
...@@ -6,9 +6,7 @@ ...@@ -6,9 +6,7 @@
<ClientOnly> <ClientOnly>
<RollToken></RollToken> <RollToken></RollToken>
</ClientOnly> </ClientOnly>
<div>
<TokenFilter></TokenFilter> <TokenFilter></TokenFilter>
</div>
<NuxtPage></NuxtPage> <NuxtPage></NuxtPage>
</div> </div>
<RightDetail <RightDetail
...@@ -29,17 +27,17 @@ ...@@ -29,17 +27,17 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import MyLayout from '@/views/layout/layout.vue'; import MyLayout from "@/views/layout/layout.vue";
import RightDetail from '@/views/token/RightDetail.vue'; import RightDetail from "@/views/token/RightDetail.vue";
import TokenFilter from '@/views/token/TokenFilter.vue'; import TokenFilter from "@/views/token/TokenFilter.vue";
import RollToken from '@/views/layout/rollToken.vue'; import RollToken from "@/views/layout/rollToken.vue";
const route = useRoute(); const route = useRoute();
const token = ref(); const token = ref();
const TbName = ref(); const TbName = ref();
const r24h = ref(); const r24h = ref();
const up = ref(); const up = ref();
const chain = useChain(); const chain = useChain();
const currentPath = ref(''); const currentPath = ref("");
onMounted(() => { onMounted(() => {
currentPath.value = chain.value; currentPath.value = chain.value;
}); });
...@@ -56,7 +54,7 @@ const changeChain = (chain) => { ...@@ -56,7 +54,7 @@ const changeChain = (chain) => {
</script> </script>
<style lang="less"> <style lang="less">
@import '@/style/variables.less'; @import "@/style/variables.less";
.home-wrapper { .home-wrapper {
width: 100vw; width: 100vw;
display: flex; display: flex;
......
<template> <template>
<div class="custom-sort-th"> <div class="custom-sort-th">
<t-tooltip :content="$t('filter.asc')"> <t-tooltip :content="$t('filter.asc')">
<AscSvg <div @click="sortChange('asc')" class="sort-icon">
:class="{ active: sorttype === 'asc' }" <AscSvg :class="{ active: sorttype === 'asc' }" class="asc"></AscSvg>
class="sort-icon asc" </div>
@click="sortChange('asc')"
></AscSvg>
</t-tooltip> </t-tooltip>
<t-tooltip :content="$t('filter.desc')"> <t-tooltip :content="$t('filter.desc')">
<div @click="sortChange('desc')" class="sort-icon">
<DescSvg <DescSvg
:class="{ active: sorttype === 'desc' }" :class="{ active: sorttype === 'desc' }"
class="sort-icon desc" class="desc"
@click="sortChange('desc')"
></DescSvg> ></DescSvg>
</div>
</t-tooltip> </t-tooltip>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import AscSvg from '/public/images/svg/collection/asc.svg'; import AscSvg from "/public/images/svg/collection/asc.svg";
import DescSvg from '/public/images/svg/collection/desc.svg'; import DescSvg from "/public/images/svg/collection/desc.svg";
const props = defineProps({ const props = defineProps({
sort: String, sort: String,
field: String, field: String,
options: Object as any, options: Object as any,
}); });
const emit = defineEmits(['submitSort']); const emit = defineEmits(["submitSort"]);
// 当前排序状态 // 当前排序状态
const sorttype = ref('all'); const sorttype = ref("all");
const sortChange = (value: string) => { const sortChange = (value: string) => {
const { field } = props; const { field } = props;
if (value == sorttype.value) { if (value == sorttype.value) {
// 代表重复点击--恢复表格初始状态 // 代表重复点击--恢复表格初始状态
sorttype.value = 'all'; sorttype.value = "all";
} else { } else {
sorttype.value = value; sorttype.value = value;
} }
emit('submitSort', { emit("submitSort", {
sort: sorttype.value, sort: sorttype.value,
field: field, field: field,
}); });
...@@ -46,7 +45,7 @@ watch( ...@@ -46,7 +45,7 @@ watch(
() => props.options, () => props.options,
(v) => { (v) => {
if (!v.status) { if (!v.status) {
sorttype.value = 'all'; sorttype.value = "all";
} }
}, },
{ {
...@@ -57,22 +56,24 @@ watch( ...@@ -57,22 +56,24 @@ watch(
<style lang="less"> <style lang="less">
.custom-sort-th { .custom-sort-th {
padding-left: 4px; margin-left: 4px;
.sort-icon { .sort-icon {
display: block;
fill: #7b7d87;
cursor: pointer; cursor: pointer;
height: 10px;
line-height: 10px;
svg {
fill: #7b7d87;
transition: all 0.2s; transition: all 0.2s;
}
.active {
fill: var(--td--main-btn-color-1);
}
&:hover { &:hover {
svg {
fill: var(--td--main-btn-color-1); fill: var(--td--main-btn-color-1);
transition: all 0.2s; transition: all 0.2s;
} }
} }
.asc {
padding: 2px 0;
}
.active {
fill: var(--td--main-btn-color-1);
} }
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment