betal-fe 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/betal-fe.js +25 -1
- package/package.json +1 -1
package/dist/betal-fe.js
CHANGED
|
@@ -1126,13 +1126,37 @@ const RouterLink = defineComponent({
|
|
|
1126
1126
|
on: {
|
|
1127
1127
|
click: (e) => {
|
|
1128
1128
|
e.preventDefault();
|
|
1129
|
-
this.
|
|
1129
|
+
this.handleNavigation(to);
|
|
1130
1130
|
},
|
|
1131
1131
|
},
|
|
1132
1132
|
},
|
|
1133
1133
|
[hSlot()]
|
|
1134
1134
|
);
|
|
1135
1135
|
},
|
|
1136
|
+
handleNavigation(to) {
|
|
1137
|
+
const anchorIndex = to.indexOf('#');
|
|
1138
|
+
if (anchorIndex !== -1 && anchorIndex > 0) {
|
|
1139
|
+
const path = to.substring(0, anchorIndex);
|
|
1140
|
+
const anchor = to.substring(anchorIndex + 1);
|
|
1141
|
+
this.appContext.router.navigateTo(path);
|
|
1142
|
+
setTimeout(() => {
|
|
1143
|
+
this.scrollToAnchor(anchor);
|
|
1144
|
+
}, 0);
|
|
1145
|
+
} else if (anchorIndex === 0) {
|
|
1146
|
+
const anchor = to.substring(1);
|
|
1147
|
+
this.scrollToAnchor(anchor);
|
|
1148
|
+
} else {
|
|
1149
|
+
this.appContext.router.navigateTo(to);
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
scrollToAnchor(anchorId) {
|
|
1153
|
+
const element = document.getElementById(anchorId);
|
|
1154
|
+
if (element) {
|
|
1155
|
+
element.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
1156
|
+
} else {
|
|
1157
|
+
console.warn(`[RouterLink] Element with id "${anchorId}" not found`);
|
|
1158
|
+
}
|
|
1159
|
+
},
|
|
1136
1160
|
});
|
|
1137
1161
|
const RouterOutlet = defineComponent({
|
|
1138
1162
|
state() {
|