import { useRouter } from "vue-router";
export function useGotoPage() {
    const router = useRouter();
    return (path, data, isNewTabs = true) => {
        console.log('path', path);
        if (isNewTabs) {
            // 打开新页面
            const url = new URL(window.location.origin + path);
            if (data) {
                Object.entries(data).forEach(([key, value]) => {
                    url.searchParams.append(key, value);
                });
            }
            window.open(url.toString(), '_blank');
        } else {
            // 当前页面打开
            router.push({ path, query: data });
        }
    }
}