-
Notifications
You must be signed in to change notification settings - Fork 10
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
scope is empty object #24
Comments
Oh 🖐️ ! Instead of installing it globally, I would rather use it in a cherry-picking-mode, where I just use it when needed, because there are some views which don't. Thanks for your input. ---- Edit: Although I think I would prefer to have the component registration locally, I tried to set it up with a global registration. ...
import { VBreakpoint } from 'vue-breakpoint-component'
Vue.use(VBreakpoint)
Vue.component('v-breakpoint', VBreakpoint)
... To make it available in all components on my page. <v-breakpoint>
<div slot-scope="scope" v-if="scope.viewportWidth">
<button v-if="scope.viewportWidth < 430" class="Navigation__menu-button" @click="toggleMenu">{{ navMenuOpen ? 'Close Menu' : 'Open Menu'}}</button>
</div>
</v-breakpoint> But only the first occurence of So maybe could you help me out, how to register the components globally and use them in multiple places? Thank you and cheers Oh and: if I install it globally as you proposed to do: import {
Plugin as VBreakpoint
} from 'vue-breakpoint-component'
Vue.use(VBreakpoint) I get this error
|
Thanks for your issue, I'll investigate asap. I should note however, that I plan to rewrite it, because it goes around in a bit of a hacky way, which possibly created this bug. |
Thanks. Much appreciated 👍 |
I'll give it a go, hopefully with some resolve tomorrow. Also, if you can, correct your code snippets. For multiline snippets use three backticks (to open/close) and paste your code in between. You can also suffix the snippet with extension, so it will highlight the code correctly. I also suggest formatting the code and removing bits that don't contribute to the issue on hand. Code highlight examplesSuffix the three opening backticks with an extension, e.g.: HTML (Vue templates)<template>
<div class="foo">hello foo</div>
</template> JavaScriptfunction foo() {
console.log("foo")
} |
I know, I was just lazy :). (I thought about using |
Did you make any progress by any chance? |
Not yet. Can you please provide a quick repro? I read your snippets, but it'll help tremendously if you are able to provide a repro. Also, what version do you use? is it latest? upgrade to latest in case it isn't and report back if the issue persists. |
I use the latest that is true. Unfortunately I don't have a quicker repro than: https://github.com/Jones-S/radio-megahex You can try to get it to run if you want to. Anyway, I think the main thing, and also how you could try this is having a vue app and including Right now I have quite a few things to do, so I wont' have time to reduce this down into a simple reproduction – I'd rather use the time to fix things on the live page with saving the current breaktpoint in vuex I guess... Sorry I will be available for questions though. |
For me it was easier to fix this issue by just using the v-breakpoint component in a component that appears on every page and then commit a mutation to save the current breakpoint in my vuex store. <template>
...
<VBreakpoint @input="updateBreakpoint($event)" />
...
</template> |
Sounds good. I'll get back to this asap. |
Hi there.
I am using vue breakpoint and I like it much so far.
Unfortunately I realized that recently i stopped working. I experience that scope is an empty object on init and is not reactively updated.
Maybe this is linked to #8 ...
I have this code:
The problem is, that scope is always empty:
![Screenshot 2020-04-27 at 17 46 51](https://user-images.githubusercontent.com/7059580/80392209-246d0400-88af-11ea-8920-3a40434d7d92.png)
Only on window resize it is updated and then things start to work.
I am not sure, what I changed, I only worked on other components, but at some point my code stopped working. Unfortunately I can't really go back, because I made some changes to the backend as well, so I can't fetch the data like I used to.
Any idea, why it is not initiated properly?
if it helps:
https://github.com/Jones-S/radio-megahex
The project is public anyway.
The text was updated successfully, but these errors were encountered: