Commit 7c51f718 by lei

1

parent 95be55e0
No preview for this file type
/*
* @Author: lei 2897821407@qq.com
* @Date: 2023-02-20 19:44:53
* @LastEditors: lei 2897821407@qq.com
* @LastEditTime: 2023-02-22 18:10:45
* @FilePath: \dexfilter-web-nuxt3\composables\useTable.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import {
DefaultChain,
filterChainObj,
......
......@@ -21,6 +21,14 @@ let filter: filterfield = {
page: 1,
page_size: 100,
};
export interface RightInfoType {
token: string;
tb: string;
tbname: string;
r24h: string;
up: string | null;
swap: string;
}
// 获取当前交易token
export const useCurToken = () => {
return useState(tokenName, () => "bar");
......@@ -47,13 +55,17 @@ export const useChangeTable = () => {
// 当前右侧的token和tb等数据
export const useCurrentRightInfo = () => {
return useState("RightInfo", () => ({
token: "",
tb: "",
r24h: "",
up: null,
swap: "",
}));
return useState(
"RightInfo",
() =>
({
token: "",
tb: "",
r24h: "",
up: null,
swap: "",
} as RightInfoType)
);
};
// 当前主题
......
interface JumpParams {
path: string;
tb: string;
}
/**
* 跳转k线
* @param params
* @param type
*/
export const JumpKLine = (params: JumpParams, type: "open" | "jump") => {
const router = useRouter();
if (type == "open") {
// 打开新的页面
const url = router.resolve({
path: `/${params.path}/${params.tb}`,
});
window.open(url.href);
}
};
......@@ -157,12 +157,12 @@ const headerBtns = computed(() => [
]);
const props = withDefaults(
defineProps<{
token: string;
scene: string;
tb: string;
token?: string;
scene?: string;
tb?: string;
currentPath: string;
r24h: number;
mt: string;
r24h?: number;
mt?: string;
up?: number;
}>(),
{
......
......@@ -42,11 +42,11 @@ import { useI18n } from "vue-i18n";
import { Button as TButton } from "tdesign-vue-next";
const { t } = useI18n();
const props = defineProps<{
token: string;
token?: string;
currentPath: string;
tb: string;
tb?: string;
PoolAddress: string;
mt: string;
mt?: string;
}>();
// 当前链
const chain = useChain();
......
......@@ -63,15 +63,15 @@ import TableEmpty from "@/components/TableEmpty.vue";
import request from "@/utils/request";
import { parseNumberToK, parseCoinAmount } from "@/utils/tool";
import { WebS } from "@/utils/TokenTrans";
// import { goDetailK } from '@/utils/router/routerGo';
import { filterChainObj } from "@/constants/UnifiedManagementChain";
import { Loading as TLoading } from "tdesign-vue-next";
import { JumpKLine } from "@/utils/router/RouterChange";
const route = useRoute();
const props = defineProps<{
poolToken: string;
currentPath: string;
tb: string;
mt: string;
mt?: string;
}>();
const emit = defineEmits(["update:address"]);
interface PoolListValue {
......@@ -100,7 +100,6 @@ watch(
}
);
const currentPoolValue = ref();
const currentPoolAddress = ref("");
onMounted(() => {
getPoolToken();
});
......@@ -167,7 +166,6 @@ const getPoolToken = async () => {
isLoading.value = false;
}
isLoading.value = false;
console.log(poolInfo.value);
} catch (e) {
console.log(e);
isLoading.value = false;
......@@ -175,20 +173,16 @@ const getPoolToken = async () => {
};
// 切换流动池
const switchPool = (item: PoolListValue, index: number) => {
// currentPoolValue.value = index;
// currentPoolAddress.value = item.address;
// emit('update:address', currentPoolAddress.value);
if (currentPoolValue.value === index) {
return;
}
let Obj = filterChainObj("value", chain.value);
// 打开新的流动池
// 打开新页面
let params = {
path: Obj.name,
tb: item.address,
};
// goDetailK(params);
JumpKLine(params, "open");
};
</script>
<style lang="less">
......
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