A
A
Alexander Belkevich2018-06-25 09:57:11
Vue.js
Alexander Belkevich, 2018-06-25 09:57:11

How to use Vue-cli but still make it multi-page?

Hello. Perhaps a little stupid question, but nevertheless .. The task arose to work with Vue not like with SPA. There is an option, of course, to connect it via CDN. But I would still like to use a component approach, and not just write huge logic on each page. Are there any options for such an implementation? Or if not SPA - then suffer through a normal connection like jQuery?
Plus, when building a project, do we get files that cannot be run without a local server? Is it possible to make it so that I can simply collect everything for the backend programmer and give it for further development? So that the project can be opened without a server

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Anton Shvets, 2018-06-25
@AlexBelkevich

Plus, when building a project, do we get files that cannot be run without a local server?

The webpack in vue-clie collects a javascript bundle for you, and how you use it is up to you. This is a static file, they do not need a server to work.
The fact is that webpack collects not only js, but also images, styles that it pulls out from js and other modules, and prescribes their connection in the calculation that html is opened from the server.
You can assemble a bundle and include it on many html pages, the main thing is that Vue finds its div#app on the page or wherever you bind it there.
But, to be honest, this is a rather strange practice, it is easier to do a SPA.
A multi-page site can also be organized using Nuxt, which generates separate html pages for each page vue component.

R
Roman Kitaev, 2018-06-25
@deliro

Oh. Read the documentation ahead and understand what SPA is.

K
Kirill Ushakov, 2018-06-25
@Bellicus

Instead <router-link>use the tag <a>, you will be reloading between pages.

D
devianllert, 2018-06-25
@devianllert

The first link in Google to the query "vue multipage" gives us a ready-made multipage template that can be used in vue-cli

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question