|
@@ -1,4 +1,4 @@
|
|
-import { computed, ref, watch, nextTick } from "vue";
|
|
|
|
|
|
+import { computed, ref, watch } from "vue";
|
|
|
|
|
|
export const urlUpdateQuery = (
|
|
export const urlUpdateQuery = (
|
|
link: string,
|
|
link: string,
|
|
@@ -47,18 +47,18 @@ const updateParams = () => {
|
|
const rParams = urlGetQuery(location.href);
|
|
const rParams = urlGetQuery(location.href);
|
|
params.value = rParams;
|
|
params.value = rParams;
|
|
for (const key in params.value) {
|
|
for (const key in params.value) {
|
|
- if (['tabulationId', 'overviewId'].includes(key)) {
|
|
|
|
- params.value[key] = Number(params.value[key])
|
|
|
|
|
|
+ if (["tabulationId", "overviewId"].includes(key)) {
|
|
|
|
+ params.value[key] = Number(params.value[key]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
updateParams();
|
|
updateParams();
|
|
|
|
|
|
-let updateNeedReload = true
|
|
|
|
|
|
+let updateNeedReload = true;
|
|
export const preventReload = () => {
|
|
export const preventReload = () => {
|
|
- updateNeedReload = false
|
|
|
|
- setTimeout(() => updateNeedReload = true)
|
|
|
|
-}
|
|
|
|
|
|
+ updateNeedReload = false;
|
|
|
|
+ setTimeout(() => (updateNeedReload = true));
|
|
|
|
+};
|
|
watch(
|
|
watch(
|
|
() => ({ ...params.value }),
|
|
() => ({ ...params.value }),
|
|
(nParams, oParams) => {
|
|
(nParams, oParams) => {
|
|
@@ -67,15 +67,20 @@ watch(
|
|
params.value[key] && sParams.append(key, params.value[key]);
|
|
params.value[key] && sParams.append(key, params.value[key]);
|
|
}
|
|
}
|
|
const ndx = location.hash.indexOf("?");
|
|
const ndx = location.hash.indexOf("?");
|
|
- location.replace(
|
|
|
|
|
|
+ const path =
|
|
location.hash.substring(0, ~ndx ? ndx : undefined) +
|
|
location.hash.substring(0, ~ndx ? ndx : undefined) +
|
|
- "?" +
|
|
|
|
- sParams.toString()
|
|
|
|
- );
|
|
|
|
|
|
+ "?" +
|
|
|
|
+ sParams.toString();
|
|
|
|
+
|
|
|
|
+ if (location.hash) {
|
|
|
|
+ location.replace(path);
|
|
|
|
+ } else {
|
|
|
|
+ location.replace(`#` + path);
|
|
|
|
+ }
|
|
if (!updateNeedReload) {
|
|
if (!updateNeedReload) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- const keys = new Set([...Object.keys(nParams), ...Object.keys(oParams)])
|
|
|
|
|
|
+ const keys = new Set([...Object.keys(nParams), ...Object.keys(oParams)]);
|
|
for (const key of keys) {
|
|
for (const key of keys) {
|
|
if (!nParams[key] || (nParams[key] && oParams[key])) {
|
|
if (!nParams[key] || (nParams[key] && oParams[key])) {
|
|
if (nParams[key] !== oParams[key]) {
|
|
if (nParams[key] !== oParams[key]) {
|