Good afternoon, I started to make a new project on vuejs2, but I ran into a strange problem. I use this template: https://github.com/vuejs-templates/webpack-simple plus add vue-router: https://github.com/vuejs/vue-router/blob/dev/examples/basic/app.js
Without a router, everything works as it should, but as soon as I connect the router, the onclick event stops working, the router itself works. It does not throw out any errors, it just stops working. Where to look and how to fix it?
UPD: I'm still dumb. in App.vue, I have this:
<template> <div id="app"> <hello></hello> <router-view></router-view> </div> </template> <script> import hello from './components/hello/Hello.vue' export default { name: 'app', components: { hello } } </script> <style>...</style> and if in hello.vue in the template you set any button with onclick, then it will not work if the component is connected in this way. And it will work if you connect the same hello.vue to the router like this:
main.js
import Vue from 'vue' import App from './App.vue' import VueRouter from 'vue-router'; import hello from './components/hello/Hello.vue' new Vue({ el: '#app', template: '<App/>', components: { App } }); Vue.use(VueRouter); const routes = [ { path: '/hello', name: 'hello', component: hello }, ]; var router = new VueRouter({ mode: 'history', base: __dirname, routes }); const app = new Vue({ router }).$mount('#app'); therefore, the question is changing: how to make it so that it would be possible to connect the components not in the router (and what would they work)? for example, in this case, I need this hello.vue to be on all pages, because it is connected to app.vue, but there it does not work correctly.