-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
Any thoughts on ways to make gon play nicely with webpacker? #239
Comments
gon is a hack. should use ajax/json to fetch the variable |
And block the app while the user waits for yet another http request? A
request whose connection overhead is multiple times larger than the payload
itself?
…On Mon, Jul 30, 2018 at 10:48 PM Ken ***@***.***> wrote:
gon is a hack. should use ajax/json to fetch the variable
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#239 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAHUpId83Ij_5I3qwIsuZj0LMAMwXq23ks5uL8VvgaJpZM4RcjtJ>
.
|
Currently, I'm doing this:
class MyController < ApplicationController
def index
@user = User.first
gon.user = @user
end
end
// app/javascript/packs/hello_vue.js
import Vue from 'vue'
import HelloVue from '../views/HelloVue.vue'
window.addEventListener('load', () => {
const app = new Vue({
el: document.getElementById('div-you-want-to-mount'),
components: { HelloVue },
render: h => h(HelloVue, { props: gon })
}).$mount()
})
<template>
<div id="hello">
User: {{ user }}
</div>
</template>
<script>
export default {
props: ['user']
}
</script> |
It would be nice to have a way to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't have any suggestions here, but wanted to start a thread about ways to make gon work in a webpacker world... Specifically such that
gon
could be imported by JS files rather than being a global?The text was updated successfully, but these errors were encountered: