更新时间:2022-04-21 21:56:25
但是我对JS框架了解不多,我认为October的标准响应数据是html呈现的,并且脚本/样式由框架注入.相反,您应该创建自己的路线并返回适当的响应.
I don't know much about JS frameworks however, I think Octobers standard response data is rendered html and scripts/styles to be injected by the framework. Instead you should create your own Routes and return the appropriate response.
例如:
# Author/Plugin/Plugin.php
public function onBoot() {
Route::get('ajax/endpoint', function() { return Post::all() });
});