Skip to content

Commit

Permalink
chore(ix-img): re-introduce vue-class-comp usage
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
luqven committed Apr 20, 2021
1 parent 8120c5c commit 92b8e06
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions src/plugins/vue-imgix/ix-img.tsx
Original file line number Diff line number Diff line change
@@ -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();
}
Expand Down Expand Up @@ -60,5 +56,4 @@ export class IxImg extends IxImgProps {
height: this.height,
});
}

};
}

0 comments on commit 92b8e06

Please sign in to comment.