Simulate Pjax with VueJS 2.0

I recently decided to check out VueJS 2.0. Since I still mainly work with various CMS systems (Wordpress, TYPO3, OctoberCMS, such things), I wanted to try and implement pjax as page loading. To my surprise, it is not as easy as I thought.

Is there a way to replace parts of a page and reinitialize components in VueJS?

I should probably explain why I want to implement such a function. In recent years, I have found it much easier and faster to develop rich websites using the frontend interface. However, since most customers need a backend to manage their websites, using an existing CMS has no problem. I used to use Angular to create an interface. It worked perfectly, even with pjax, since you can reinitialize portions of a page in Angular 1.0.

Angular 2.0 took a different approach, and although I absolutely adore what they did with it, I don’t think it is suitable for use in an environment where most interfaces are processed by the server. That is why I decided to check out VueJS.

I want to implement a pjax-like function, because HTML is already being processed on the server and dynamically replacing parts of the page just looks cool :)

EDIT

Just to be clear, I'm not talking about the jQuery pjax plugin, about dynamically replacing parts of a page (which in the company I worked for before was simply called "pjax": P)

+4
source share
1 answer
+1

Source: https://habr.com/ru/post/1665452/


All Articles