更新路由历史模式为 hash,并调整生成的 URL 以支持 hash 模式下的参数解析
This commit is contained in:
parent
03a19beafa
commit
64fd4d1a71
@ -1,7 +1,7 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import { createRouter, createWebHashHistory } from 'vue-router';
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
history: createWebHashHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
|
@ -79,7 +79,7 @@ const updateGeneratedUrl = () => {
|
||||
type: selectedWidget.value,
|
||||
config: currentWidgetConfig.value
|
||||
});
|
||||
generatedUrl.value = `${baseUrl}/preview?data=${configStr}`;
|
||||
generatedUrl.value = `${baseUrl}/#/preview?data=${configStr}`;
|
||||
};
|
||||
|
||||
// 复制 URL 到剪贴板
|
||||
|
@ -33,7 +33,9 @@ const widgetComponent = computed(() => {
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
const queryParams = new URLSearchParams(window.location.search);
|
||||
// 在 hash 模式下获取 URL 参数
|
||||
const searchParams = window.location.href.split('?')[1];
|
||||
const queryParams = new URLSearchParams(searchParams || '');
|
||||
const data = queryParams.get('data');
|
||||
|
||||
if (data) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user