We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$template 的赋值有时候会是变量或表达式, 目前编译产出如下:
class DemoComponent extends Component { public static $filters; public static $computed; // $templateHTML 是个变量 public static $template = $templateHTML; }
发现运行时报错: Fatal error: syntax error, unexpected T_VARIABLE, 查了下文档, 说是:
Fatal error: syntax error, unexpected T_VARIABLE
属性中的变量可以初始化,但是初始化的值必须是常数,这里的常数是指 PHP 脚本在编译阶段时就可以得到其值,而不依赖于运行时的信息才能求值。
改成下面这样就好使了:
class DemoComponent extends Component { public static $filters; public static $computed; public static $template; } DemoComponent::$template = $templateHTML;
The text was updated successfully, but these errors were encountered:
b112ed5
已经修复。参考这个 case:
https://github.com/searchfe/san-ssr/blob/b112ed53929400e252aae088ce8a696833e0cd01/test/cases/property-initializer/component.ts#L5-L12
Sorry, something went wrong.
chore(release): 1.2.1 [skip ci]
9b424fb
## [1.2.1](v1.2.0...v1.2.1) (2019-11-07) ### Bug Fixes * refactor non-constant property initializer for php, fixes [#16](#16) ([b112ed5](b112ed5))
🎉 This issue has been resolved in version 1.2.1 🎉
The release is available on:
Your semantic-release bot 📦🚀
No branches or pull requests
$template 的赋值有时候会是变量或表达式, 目前编译产出如下:
发现运行时报错:
Fatal error: syntax error, unexpected T_VARIABLE
, 查了下文档, 说是:改成下面这样就好使了:
The text was updated successfully, but these errors were encountered: