set initial selection
ad34 opened this issue · comments
Ad34 commented
I'm currently trying to set an initial selection but looks like filling the array declared in @onselectmultipleimage but update the selection. is there any way to do this?
Irfan Maulana commented
Not possible for now, but I can add in next release.
Or if you want di your own implementation, just fork and feel free to open pull request.
I will review your code.
Thanks
Mirko commented
You can do it by accessing the reference directly.
For example:
<vue-select-image ref="imageSelector"></vue-select-image>
For multiple selection:
const images = [
{ id: '...', src: '...'},
//...
];
this.$refs.imageSelector.multipleSelected = images;
For single selection (not tested):
const image_id = '...';
this.$set(this.$refs.imageSelector.singleSelected, 'id', image_id);
Irfan Maulana commented
I do not recommend using $refs
, use props
:selectedImages
with Array type.
You can also doing for singleSelection with same way.