Skip to content

Commit 397bf2a

Browse files
committed
fix: issue with vue v-model
1 parent a4cd422 commit 397bf2a

File tree

10 files changed

+14
-10
lines changed

10 files changed

+14
-10
lines changed

packages/components/scripts/post-build/vue.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ export default (tmp?: boolean) => {
6363
)
6464
)})\n\nconst props =`
6565
});
66+
replacements.push({
67+
from: 'handleFrameworkEventVue(() => {}',
68+
to: 'handleFrameworkEventVue(emit'
69+
});
6670
}
6771

6872
runReplacements(replacements, component, 'vue', vueFile);

packages/components/src/components/checkbox/checkbox.lite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default function DBCheckbox(props: DBCheckboxProps) {
6262
useTarget({
6363
angular: () =>
6464
handleFrameworkEventAngular(this, event, 'checked'),
65-
vue: () => handleFrameworkEventVue(this, event, 'checked')
65+
vue: () => handleFrameworkEventVue(() => {}, event, 'checked')
6666
});
6767

6868
/* For a11y reasons we need to map the correct message with the checkbox */

packages/components/src/components/input/input.lite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default function DBInput(props: DBInputProps) {
8181

8282
useTarget({
8383
angular: () => handleFrameworkEventAngular(this, event),
84-
vue: () => handleFrameworkEventVue(this, event)
84+
vue: () => handleFrameworkEventVue(() => {}, event)
8585
});
8686

8787
/* For a11y reasons we need to map the correct message with the input */

packages/components/src/components/radio/radio.lite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function DBRadio(props: DBRadioProps) {
4141
useTarget({
4242
angular: () =>
4343
handleFrameworkEventAngular(this, event, 'checked'),
44-
vue: () => handleFrameworkEventVue(this, event, 'checked')
44+
vue: () => handleFrameworkEventVue(() => {}, event, 'checked')
4545
});
4646
},
4747
handleBlur: (event: InteractionEvent<HTMLInputElement>) => {

packages/components/src/components/select/select.lite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default function DBSelect(props: DBSelectProps) {
8585

8686
useTarget({
8787
angular: () => handleFrameworkEventAngular(this, event),
88-
vue: () => handleFrameworkEventVue(this, event)
88+
vue: () => handleFrameworkEventVue(() => {}, event)
8989
});
9090

9191
/* For a11y reasons we need to map the correct message with the select */

packages/components/src/components/switch/switch.lite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default function DBSwitch(props: DBSwitchProps) {
4545
useTarget({
4646
angular: () =>
4747
handleFrameworkEventAngular(this, event, 'checked'),
48-
vue: () => handleFrameworkEventVue(this, event, 'checked')
48+
vue: () => handleFrameworkEventVue(() => {}, event, 'checked')
4949
});
5050
},
5151
handleBlur: (event: InteractionEvent<HTMLInputElement>) => {

packages/components/src/components/tab-item/tab-item.lite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default function DBTabItem(props: DBTabItemProps) {
5353
useTarget({
5454
angular: () =>
5555
handleFrameworkEventAngular(this, event, 'checked'),
56-
vue: () => handleFrameworkEventVue(this, event, 'checked')
56+
vue: () => handleFrameworkEventVue(() => {}, event, 'checked')
5757
});
5858
}
5959
});

packages/components/src/components/textarea/textarea.lite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default function DBTextarea(props: DBTextareaProps) {
7272
}
7373
useTarget({
7474
angular: () => handleFrameworkEventAngular(this, event),
75-
vue: () => handleFrameworkEventVue(this, event)
75+
vue: () => handleFrameworkEventVue(() => {}, event)
7676
});
7777

7878
/* For a11y reasons we need to map the correct message with the textarea */

packages/components/src/utils/form-components.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ export const handleFrameworkEventAngular = (
1010
};
1111

1212
export const handleFrameworkEventVue = (
13-
component: any,
13+
emit: (event: string, ...args: any[]) => void,
1414
event: any,
1515
modelValue: string = 'value'
1616
): void => {
1717
// TODO: Replace this with the solution out of https://github.com/BuilderIO/mitosis/issues/833 after this has been "solved"
18-
component.emit(`update:${modelValue}`, event.target[modelValue]);
18+
emit(`update:${modelValue}`, event.target[modelValue]);
1919
};

showcases/vue-showcase/src/components/section/Section.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { DBSection, DBCard } from "../../../../../output/vue/src";
1010
#example="{ exampleIndex, variantIndex, exampleName, exampleProps }"
1111
>
1212
<DBSection
13-
className="db-informational-bg-basic-level-2 section-card-container"
13+
class="db-informational-bg-basic-level-2 section-card-container"
1414
:spacing="exampleProps?.spacing"
1515
:width="exampleProps?.width"
1616
>

0 commit comments

Comments
 (0)