我是vue js的新手,正在尝试学习这一点。我在系统中安装了新版本的vue Webpack。我有一个css,js和该主题模板的图像,希望将其包含到HTML中,因此我尝试将其添加到其中,index.html
但可以看到控制台中的错误,并且未添加资产。在搜索时,我知道可以require
在main.js
文件中使用。但是我得到了错误:
以下是我尝试过的main.js
文件:
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
require('./assets/styles/vendor.css');
require('./assets/styles/main.css');
require('./assets/scripts/vendor/modernizr.js');
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
})
虽然我尝试使用导入来使用它,但仍然出现错误
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import('./assets/styles/vendor.css')
// require('./assets/styles/vendor.css');
// require('./assets/styles/main.css');
// require('./assets/scripts/vendor/modernizr.js');
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
})
帮我解决这个问题。