Skip to content

Commit 013f647

Browse files
sreenathsJohanAhlen
authored andcommitted
[ui] Vue 3 - Migrated HueLink component
1 parent 8049ca8 commit 013f647

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

desktop/core/src/desktop/js/components/HueLink.vue

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,39 @@
2121
</template>
2222

2323
<script lang="ts">
24+
import { defineComponent } from 'vue';
25+
2426
import { onHueLinkClick } from 'utils/hueUtils';
25-
import Vue from 'vue';
26-
import Component from 'vue-class-component';
27-
import { Prop } from 'vue-property-decorator';
2827
2928
interface hueWindow {
3029
HUE_BASE_URL: string;
3130
}
3231
33-
@Component
34-
export default class HueLink extends Vue {
35-
@Prop({ required: false })
36-
url?: string;
32+
export default defineComponent({
33+
props: {
34+
url: {
35+
type: String,
36+
required: false,
37+
default: ''
38+
}
39+
},
40+
41+
emits: ['click'],
3742
3843
created(): void {
3944
delete this.$attrs.href;
40-
}
41-
42-
clicked(event: Event): void {
43-
if (this.url) {
44-
onHueLinkClick(event, this.url, this.$attrs.target);
45-
} else {
46-
this.$emit('click');
45+
},
46+
47+
methods: {
48+
clicked(event: Event): void {
49+
if (this.url && this.$attrs.target) {
50+
onHueLinkClick(event, this.url, <string>this.$attrs.target);
51+
} else {
52+
this.$emit('click');
53+
}
4754
}
4855
}
49-
}
56+
});
5057
</script>
5158

5259
<style lang="scss" scoped></style>

0 commit comments

Comments
 (0)