Edd*_*ofo 5 laravel server-side-rendering vue-router vuejs2 v8js
我正在尝试使用 V8Js 在 Laravel 中使用 VueJS 和 VueRouter 实现 SSR,但我不断出现此错误:
V8JsScriptException
V8Js::compileString():1812: ReferenceError: document is not defined
Run Code Online (Sandbox Code Playgroud)
V8JsScriptException
V8Js::compileString():1812: ReferenceError: document is not defined
Run Code Online (Sandbox Code Playgroud)
...
$js =
<<<EOT
var process = { env: { VUE_ENV: "server", NODE_ENV: "production" } };
this.global = { process: process };
var url = "$path";
EOT;
$v8 = new \V8Js();
$v8->executeString($js);
$v8->executeString($renderer_source);
$v8->executeString($app_source);
$markup = ob_get_clean();
return $markup;
...
Run Code Online (Sandbox Code Playgroud)
在 SSR 中没有窗口或文档,我知道,但我不知道我的错误在哪里。如果还有需要的细节我可以提供,谢谢。
归档时间: |
|
查看次数: |
362 次 |
最近记录: |