1.安装
npx create-nuxt-app <项目名>
2.运行
cd nuxt npm run dev
3.打包/启动
cd nuxt npm run build npm start
资源路径:
vue:/static/img/facebook.png
nuxt:/img/facebook.png
全局css:
nuxt.config.js
store修改:
vue
const store = new Vuex.Store({ state, getters, mutations, actions }) export default store
改为
const createStore = () => { return new Vuex.Store({ state, getters, mutations, actions }) } export default createStore
VeeValidate
安装nuxt-validate:https://www.npmjs.com/package/nuxt-validate
js-cookie
安装:cookie-universal-nuxt
https://www.npmjs.com/package/cookie-universal-nuxt
vue-awesome-swiper:
https://www.npmjs.com/package/vue-awesome-swiper
https://github.com/surmon-china/vue-awesome-swiper/tree/master/examples/nuxt-ssr-example
vuejs-paginate
plugins文件夹下添加文件vuejs-paginate.js
import Vue from 'vue' import Paginate from 'vuejs-paginate' Vue.component('paginate', Paginate)
nuxt.config.js添加配置
plugins: [ { src: '~/plugins/vuejs-paginate.js', ssr: false } ]
相关参考:https://segmentfault.com/q/1010000007871843