Browse Source

[ui] Vue 3 - Migrated HueLink component

sreenaths 4 years ago
parent
commit
013f64703a
1 changed files with 22 additions and 15 deletions
  1. 22 15
      desktop/core/src/desktop/js/components/HueLink.vue

+ 22 - 15
desktop/core/src/desktop/js/components/HueLink.vue

@@ -21,32 +21,39 @@
 </template>
 </template>
 
 
 <script lang="ts">
 <script lang="ts">
+  import { defineComponent } from 'vue';
+
   import { onHueLinkClick } from 'utils/hueUtils';
   import { onHueLinkClick } from 'utils/hueUtils';
-  import Vue from 'vue';
-  import Component from 'vue-class-component';
-  import { Prop } from 'vue-property-decorator';
 
 
   interface hueWindow {
   interface hueWindow {
     HUE_BASE_URL: string;
     HUE_BASE_URL: string;
   }
   }
 
 
-  @Component
-  export default class HueLink extends Vue {
-    @Prop({ required: false })
-    url?: string;
+  export default defineComponent({
+    props: {
+      url: {
+        type: String,
+        required: false,
+        default: ''
+      }
+    },
+
+    emits: ['click'],
 
 
     created(): void {
     created(): void {
       delete this.$attrs.href;
       delete this.$attrs.href;
-    }
-
-    clicked(event: Event): void {
-      if (this.url) {
-        onHueLinkClick(event, this.url, this.$attrs.target);
-      } else {
-        this.$emit('click');
+    },
+
+    methods: {
+      clicked(event: Event): void {
+        if (this.url && this.$attrs.target) {
+          onHueLinkClick(event, this.url, <string>this.$attrs.target);
+        } else {
+          this.$emit('click');
+        }
       }
       }
     }
     }
-  }
+  });
 </script>
 </script>
 
 
 <style lang="scss" scoped></style>
 <style lang="scss" scoped></style>