vue project uses nuxt do server-side rendering

 

 

 

 

 

 

First, according to the official website nuxt from scratch to build the project:

1. Create a new project directory:

2. New package.json In the current project, setting how to run nuxt:

3. Install nuxt, npm install --save nuxt

4. The following is the directory structure of our project:

Under each file separately said corresponding role

pages each page is the corresponding routing

components directory is the package of components, I head here encapsulates the public and public and bottom view of the carousel plugin.

Here encountered when different nuxt introduce a third party plug-ins and vue, we need to do the following in plugins and nuxt.config.js:

 New vue-swiper.js in plugins in

Then configure the plug-in to be used in nuzt.config.js

Swiper can then be used in the assembly

layouts layout, we project that the public head and bottom, the middle view

Such a project is complete nuxt

Results are as follows:

Guess you like

Origin www.cnblogs.com/zpxm/p/11893374.html