Why the event handling cannot work in vue

Hi,
I create a vue-meteor example, but the event cannot fire.
Follow is the github url:
https://github.com/SvenWangChina/meteor-vue-vue-router-ssr-example

Has anyone encountered something similar? Thanks

Hmm yeah that’s weird, I haven’t had any issues like that. I don’t see anything wrong with your component code so there must be something wrong with your setup. Maybe take a look at Akryum’s example projects. You can also check out mine

You may want to read this: Reactivity In Vue.js (And Its Pitfalls)

I compare the two project, cannot find the reason…

thanks。Let me see see.

Didn’t seem to be a reactivity issue, the click event is simply not firing at all, with no errors either.

You don’t have any client-side JavaScript, in its current state your app is SSR only. Please take a look at the vue-meteor-demo, and especially the src/index.js file.

3 Likes

You are right. It resolved when I added the following code(Meteor.isClient):

import { Meteor } from 'meteor/meteor';

if (Meteor.isClient) {
    import './imports/client';
} else if (Meteor.isServer) {
    import './imports/server';
}

the client code is:

import { Meteor } from 'meteor/meteor'
import CreateApp from './app'

Meteor.startup(() => {
    CreateApp();
});

Thanks very much.

1 Like