V8Js::compileString():14026:ReferenceError:未定义窗口


<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
use IlluminateSupportFacadesFile;
class AppController extends Controller
{
private function render() {
$renderer_source = File::get(base_path('node_modules/vue-server-renderer/basic.js'));
$app_source = File::get(public_path('js/entry-server.js'));
$v8 = new V8Js();
ob_start();
$v8->executeString('var process = { env: { VUE_ENV: "server", NODE_ENV: "production" }}; this.global = { process: process };');
$v8->executeString($renderer_source);
$v8->executeString($app_source);
return ob_get_clean();
}
public function get() {
$ssr = $this->render();
return view('app', ['ssr' => $ssr]);
}
}

我紧随其后https://dzone.com/articles/server-side-rendering-with-laravel-amp-vuejs-25本页和已安装V8J。但是$v8->executeString($app_source);犯了一个错误V8Js::compileString():14026:ReferenceError:未定义窗口。

我不知道该如何处理这个错误。。

问题是使用窗口对象引导.js。THX!

相关内容

  • 没有找到相关文章

最新更新