cooking
cooking copied to clipboard
node 6.10版本 ,支持吗?
6.4正常,6.10,遇到以下问题 ERROR in ./src/index.js Module not found: Error: Can't resolve './app' in '/mnt/subs/src' @ ./src/index.js 13:11-27 @ multi webpack-dev-server/client?http://0.0.0.0:8888/ webpack/hot/dev-server webpack-hud ./src/index.js
//index.js 中的代码如下
import Vue from 'vue';
import VueRouter from 'vue-router';
import './styles/sass/common.scss';
import App from './app';
import configRouter from './router.js';
// footer
import publicFooter from './components/footer';
// 使用路由
Vue.use(VueRouter);
Vue.component('publicFooter', publicFooter);
/**
* 路由相关 路由规则配置
* */
const router = new VueRouter({
mode: 'hash',
base: __dirname,
routes: configRouter
});
new Vue({
// el: '#app',
render: h => h(App),
router
}).$mount('#app');
我也遇到了类似问题,可以运行,但是初始化不成功
I face a similar problem when trying the get started in vue-router. the router-links show, but the router-view is not rendering anything.
<template>
<div>
<h1>Hello App!</h1>
<p>
<!-- use router-link component for navigation. -->
<!-- specify the link by passing the `to` prop. -->
<!-- <router-link> will be rendered as an `<a>` tag by default -->
<router-link to="/foo">Go to Foo</router-link>
<router-link to="/bar">Go to Bar</router-link>
</p>
<!-- route outlet -->
<!-- component matched by the route will render here -->
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'app'
};
</script>
import Vue from 'vue';
import App from './app';
import VueRouter from 'vue-router';
Vue.use(VueRouter);
const Foo = { template: '<div>foo</div>' };
const Bar = { template: '<div>bar</div>' };
const routes = [
{ path: '/foo', component: Foo },
{ path: '/bar', component: Bar }
];
const router = new VueRouter({
routes // short for routes: routes
});
new Vue({ // eslint-disable-line
render: h => h(App),
router
}).$mount('#app');