0👍
To my knowledge, you can’t. Since Laravel is not actually serving *.blade.php
files to you but rather compiles them to plain PHP, puts into storage/framework/views
(by default) folder and then serves.
From official docs:
In fact, all Blade views are compiled into plain PHP code and cached until they are modified
So in any case, there would have to happen a page refresh to serve other PHP file.
- [Vuejs]-How to place a placeholder text inside the textbox
- [Vuejs]-Vuejs router how reload a javascript plugin
0👍
You can use ajax to get html as response and render in vue.
In your controller:
public function renderHtml()
{
$data = ... ;
$html = view('test',compact('data')->render();
return response()->json($html);
}
In your Vue component use vanilla JS or jquery to get the markup and bind it to the comonent
fetch('renderhtml')
.then(response => () {
element.innerHTML(response.data);
});
Note that this is not a really reliable solution for every case.
Source:stackexchange.com