betal-fe 4.0.1 → 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 +27 -2
- package/package.json +1 -1
package/dist/betal-fe.js
CHANGED
|
@@ -1117,21 +1117,46 @@ function defineComponent({ render, state, onMounted = emptyFunction, onUnmounted
|
|
|
1117
1117
|
|
|
1118
1118
|
const RouterLink = defineComponent({
|
|
1119
1119
|
render() {
|
|
1120
|
-
const { to } = this.props;
|
|
1120
|
+
const { to, ...rest } = this.props;
|
|
1121
1121
|
return h(
|
|
1122
1122
|
"a",
|
|
1123
1123
|
{
|
|
1124
1124
|
href: to,
|
|
1125
|
+
...rest,
|
|
1125
1126
|
on: {
|
|
1126
1127
|
click: (e) => {
|
|
1127
1128
|
e.preventDefault();
|
|
1128
|
-
this.
|
|
1129
|
+
this.handleNavigation(to);
|
|
1129
1130
|
},
|
|
1130
1131
|
},
|
|
1131
1132
|
},
|
|
1132
1133
|
[hSlot()]
|
|
1133
1134
|
);
|
|
1134
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
|
+
},
|
|
1135
1160
|
});
|
|
1136
1161
|
const RouterOutlet = defineComponent({
|
|
1137
1162
|
state() {
|