Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually redraw with <script setup> Syntax? #132

Open
datWeazel opened this issue Jul 14, 2022 · 3 comments
Open

Manually redraw with <script setup> Syntax? #132

datWeazel opened this issue Jul 14, 2022 · 3 comments

Comments

@datWeazel
Copy link

I'm currently rewriting some old Vue components in the new <script setup> Syntax. In one of the components vue-masonry is used and this.$redrawVueMasonry() is called. Obviously this. is no longer available with <script setup> Syntax.

Is there any way to manually redraw when using the new syntax?

@shershen08
Copy link
Owner

for v3 + script setup you should be able to use

<script setup>
import {inject} from 'vue';
const redrawVueMasonry  = inject('redrawVueMasonry');
// call redrawVueMasonry()

https://github.com/shershen08/vue-masonry/blob/master/src/masonry.plugin.js#L138

@datWeazel
Copy link
Author

Thanks for the response. Would this work with vue2.7? We are currently still on 2.7, rewriting everything with <script setup> to make migrating to Vue3 easier.

@MartinX3
Copy link

It seems not to work in 2.7
injection "redrawVueMasonry" not found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants