Skip to content

Commit 7ae74fc

Browse files
committed
fix(CustomControl): ensure control index is set correctly
1 parent 3130c3d commit 7ae74fc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/CustomControl.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export default defineComponent({
6262
const addControl = (controlPosition: IControlPosition) => {
6363
if (map.value && api.value && controlRef.value) {
6464
const position = api.value.ControlPosition[controlPosition];
65+
(controlRef.value as ControlRef).index = props.index;
6566
map.value.controls[position].push(controlRef.value);
6667
}
6768
};
@@ -97,7 +98,9 @@ export default defineComponent({
9798
watch(
9899
() => props.index,
99100
(newIndex) => {
100-
if (newIndex && controlRef.value) (controlRef.value as ControlRef).index = props.index;
101+
if (!controlRef.value) return;
102+
103+
(controlRef.value as ControlRef).index = newIndex;
101104
}
102105
);
103106

0 commit comments

Comments
 (0)