There is no need to make the project into a single-page application for the time being, so can vue be simply used in traditional multi-page projects? Has anyone done this before? what should I be aware of?
I always thought that if I used vue as jquery, I would be called a fool. Now that I have an authoritative answer, I can use it without restraint. Thank you!
The answers below are all pretty good, but 南小鸟’s answer is like, you have a question about stocks, and Buffett comes to answer it for you. You have no resistance. It can be adopted. . .
I think you should adopt it
Of course. Before vue was so popular, vue was used as jquery in the Laravel circle 23333
It works without any problems.
It can be used, Vue also has server-side rendering, although it’s still a bit confusing now
It’s ok
Yes, just import the <script> tag directly.
Use it like jq
Can be used as a progressive framework, you can completely use Vue as a replacement for jQuery. In the Vue officially integrated by Laravel, Vue is actually combined with the back-end template engine rather than completely separated from the front-end and back-end.
At this time, what you actually need to provide are custom components, not complete pages, otherwise you will encounter an embarrassing problem: why do each of my pages render the same.
I just mixed vue and ci to do two or three projects. I think, at least for now, it is not possible to replace jquery with vue. jquery's wheels are much richer than vue. I even mixed vue and jquery and there was still no problem. But I will use vue wherever vue can be used. After all, there is no need to manually update the dom
The original problem has been solved, but I still have to say that if you use Vue for multi-page applications, you must use server-side rendering, otherwise there will be unresolved mustache expressions like {{..}} on the page first. , and then the result appears again.