M
M
Mors Clamor2020-04-14 12:49:45
Yii
Mors Clamor, 2020-04-14 12:49:45

How to embed Vue in yii2 website?

Hello, there is a site purely in yii2, it gives statics, and some interactivity is written in jquery. It was decided to transfer the whole thing to vue. Now the site consists of many widgets, I will explain using the example of a user's posts feed.

I need to add reactivity to the site so that I can still take full advantage of yii2. For example, now the list of posts gives yii2, and likes and deletions are made on jquery. If I use vue then I will have to load the list of posts in mounted() instead of just user->posts for example. It's like an example.

How to correctly distinguish between frameworks? Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Shalaev, 2020-04-24
@66demon666

Usually such things are implemented quite simply: they divide the site into 2 applications - backend and frontend. They are isolated from each other and live on their own, communicating through the API. If you want a partial implementation, then you can write widgets that will be collected by webpack into separate files (if you have http2 configured, then it's better to do just that) and embed the compiled html on the page at the time the file is loaded)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question