From a4d70273ba793ef471a8e87397f31a74b1526b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Wed, 24 Mar 2021 20:38:04 +0100 Subject: [PATCH] fix v-sl-model crash --- ui/src/main.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/src/main.ts b/ui/src/main.ts index 4c09548..b6f6e62 100644 --- a/ui/src/main.ts +++ b/ui/src/main.ts @@ -1,8 +1,8 @@ import * as Vue from "vue"; -import {DirectiveBinding} from "vue"; +import { DirectiveBinding } from "vue"; import App from "./App.vue"; import router from "./router"; -import {defineCustomElements, setAssetPath, SlInput,} from "@shoelace-style/shoelace"; +import { defineCustomElements, setAssetPath, SlInput, } from "@shoelace-style/shoelace"; // TODO: Remove when UI settles! defineCustomElements(); @@ -10,17 +10,15 @@ setAssetPath(`${window.location.origin}/${process.env.VUE_APP_ASSET_PATH}/`); const app = Vue.createApp(App); app.use(router); -app.mount("#app"); app.config.isCustomElement = (tag: string) => Boolean(tag.match(/^sl-/)); - app.directive("sl-model", { beforeMount: (element: Element, binding: DirectiveBinding) => { element.addEventListener("slInput", (event) => { const slElement = event?.target as - | typeof SlInput.prototype - | undefined; + | typeof SlInput.prototype + | undefined; const value = slElement?.value; if (value && binding.instance) { (binding.instance.$data as { [key: string]: unknown })[binding.arg as string] = value; @@ -34,3 +32,5 @@ app.directive("sl-model", { } }, }); + +app.mount("#app"); \ No newline at end of file