Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
966 views
in Technique[技术] by (71.8m points)

vuejs2 - Can we transfer a vue.js project to a nuxt.js project and how?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Your question is very relative.

I'll try some tips for you, and maybe you can look at the options.

Nuxt is a framework, it works in a pre-defined way, you need to create the structure of your code inside an appropriate folders. Example are the stores, layouts, the pages or the components...

So, let's assume that you have a vue component and need to migrate it to NuxtJs. The code inside the component is a little different, but not so much, because in the vue you need to declare the vue instance, and import the things to render, since Nuxt does this in an automated way, you will not create new vue instances, only a .vue file and configure the and sessions. Nuxt will generate things for you automatically. So the programming is more dynamic.

Therefore, you will not need to recreate all of your code, but you will need to re-tag it in the Nuxt pattern. Which in fact is unfortunately almost the same thing as recreating everything again.

But think on the bright side, you will be using your entire code blocks, which will make development very fast.

So what you will have to do is to recreate the entire structure of pages, components, layouts, copying their excerpts from the vue application codes to the new files within the Nuxt directory structure. It will be a lot of work, but I'm sure the end result will be much better.

It makes no sense for your application to not use nuxt, for hundreds of thousands of reasons.

That's it, I hope I helped you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...