S
S
sergeyviktorovich2021-01-17 23:11:47
1C-Bitrix
sergeyviktorovich, 2021-01-17 23:11:47

How to use vue.js in Bitrix?

I read that Bitrix supports vue code, but I don’t know how to apply it in component templates

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-01-18
@sergeyviktorovich

Bitrix is ​​a framework and CMS - in short, a backend. What does he have to do with the front? Make it in Vue, React, whatever you want and use it however you want.
The fact that Bitrix supports Vue only means that Vue has been added to the set of js libraries for Bitrix and now you can connect it to the page via the API.
In addition, the built-in bible is placed in the BX object and you should access it like this - BX.Vue + a few goodies have been added to it.
But as far as I know, it is not used anywhere in regular templates and it cannot be used there in any way, since they all operate on the DOM, i.e. are essentially incompatible with reactive libraries.
Full document on usage here: https://dev.1c-bitrix.ru/learning/course/index.php...
But I wouldn't use it.
Generally speaking, there is some conflict between Bitrix and Vue - on the one hand, the templates of modern Bitrix components are completely sharpened in functionality and ideology for the reactive framework, on the other hand, it is completely impossible to rewrite them on them, since they require server rendering (which at least not yet do not tie it to Bitrix) otherwise you will be left without indexing, and some pre-render 80% of Bitrix users will not master.
As a result, it remains only to dream about Vue in the future, but for now, in regular components, render HTML on the server, and then manipulate the DOM on the client, turning customization of regular templates into hell.
In a word, if you want to use Vue with Bitrix - use it, but forget about regular templates in general. And use your own Vue, not the built-in one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question