From 92b8e0669f45c8e6ac4e4122c20a54a10dd470b4 Mon Sep 17 00:00:00 2001 From: Luis Ball Date: Tue, 20 Apr 2021 10:20:12 -0400 Subject: [PATCH] chore(ix-img): re-introduce vue-class-comp usage This commit reverts a change where vue-class-component was removed. Instead, it makes proper use of the `prop` and `Vue` exports from that library. --- src/plugins/vue-imgix/ix-img.tsx | 37 ++++++++++++++------------------ 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/plugins/vue-imgix/ix-img.tsx b/src/plugins/vue-imgix/ix-img.tsx index d73da32c..1696acd1 100644 --- a/src/plugins/vue-imgix/ix-img.tsx +++ b/src/plugins/vue-imgix/ix-img.tsx @@ -1,30 +1,26 @@ -import { defineComponent, h } from 'vue'; +import { h } from 'vue'; import { ensureVueImgixClientSingleton, IVueImgixClient } from './vue-imgix'; - -const IxImgProps = defineComponent({ - props: { - src: { - type: String, - required: true, - }, - fixed: Boolean, - imgixParams: Object, - width: [String, Number], - height: [String, Number], - attributeConfig: Object, - disableVariableQuality: Boolean, - }, -}); +import { prop, Vue } from 'vue-class-component'; const defaultAttributeMap = { src: 'src', srcset: 'srcset', }; -export class IxImg extends IxImgProps { - // Using !: here because we ensure it is set in created() +class Props{ + src = prop({ + type: String, + required: true, + }); + fixed = prop({type: Boolean}); + imgixParams = prop({type: Object}); + width = {type: [String, Number]}; + height = {type: [String, Number]}; + attributeConfig = prop({type: Object}); + disableVariableQuality = prop({type: Boolean}); +}; +export class IxImg extends Vue.with(Props) { private vueImgixSingleton!: IVueImgixClient; - created() { this.vueImgixSingleton = ensureVueImgixClientSingleton(); } @@ -60,5 +56,4 @@ export class IxImg extends IxImgProps { height: this.height, }); } - -}; +}