Answer the question
In order to leave comments, you need to log in
Is it possible to include a php file in vue?
Hello, I'm interested in such a question, is it possible and if so, how to connect a php file to vuejs?
<template src="template.php">
</template>
Answer the question
In order to leave comments, you need to log in
If you are trying to put the execution of php code into the vue template in this way, then you are doing something wrong)))
This, in principle, cannot be and it will not work))
I know that only html is supported, but now there is such a needoh how everything is running ... you don't know anything jon snow .. nothing ..
You can connect not only html, but also other template engines - pug for example. and in general - you can write your own loader for the webpack plugin (webpack deals with SFC components)
another question - WHY was such a NEED FOR? if you know why, maybe the community will tell you the right way to solve it.
Yes, you are right, I did not quite fully describe the task of the site.
The site is written in cms bitrix, and it became necessary to translate one of the pages of the site into a framework, I chose vue.
In bitrix, the files have the php extension and there is both a template and functionality, since I chose vue, I want to make everything beautiful. The bitrix component is inserted into the page that needs to be redone via $APPLICATION->IncludeComponent
and now I'm wondering if I can somehow connect this component.
I am not familiar with Bitrix, but judging by the description, it is possible to do so.
The page is written in php including markup and logic. So in the view you transfer the markup, and logic, and everything else. on the original page, delete everything except php code inserts, and hang some #app on the root div, and create a Vue application with el: "#app"
Not very familiar with Bitrix. But I think there are controllers there, you write all PHP execution in the controller on the server, and give it to the view as json when mounted, for example
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question