Skip to content

HMR with inline-template bindings doesn't seem to work #43

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

Open
ghost opened this issue Dec 27, 2016 · 0 comments
Open

HMR with inline-template bindings doesn't seem to work #43

ghost opened this issue Dec 27, 2016 · 0 comments

Comments

@ghost
Copy link

ghost commented Dec 27, 2016

Sample code:

export const foo = {
    template: "",

    data: () => ({
        visible: false
    }),

    methods: {
        toggle: function() { 
            this.visible = !this.visible; 
        }
    }
};
<foo inline-template>
    <div>
        <button v-on:click="toggle"></button> 
        <div v-bind:class="{visible: visible}">
            bar
        </div>
    </div>
</foo>
import { foo } from "./foo";

if (module.hot) {
    const api = require("vue-hot-reload-api");

    api.install(Vue);

    if(!module.hot.data) {
        api.createRecord("foo-id", foo);
    } else {
        api.reload("foo-id", foo);
    }

    module.hot.accept();
}

const app = new Vue({
    el: "#app",

    components: {
        "foo": foo
    }
});

After a hot reload the HTML bindings seem to be lost. The html is served from a server and bound on the client. Is there a way to make that work with hot reloading? I'm trying out a progressive enhancement approach.

Thank you in advance!

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

No branches or pull requests

0 participants