变量注入

示例

krau.json

{
...
    "default": {
        ...
        "foo": "bar",
        "obj": {
            "a": "aa"
        }
    }
...
}

entry.wp.js

let foo2 = foo // 'bar',注意声明变量不能与 npx.json 中的定义变量重名
let objA = obj.a // 'aa'

index.hbs

<!doctype html>
<html>
    <head></head>
    <body>
        <p>foo = {{foo}}</p>
        <p>objA = {{obj.a}}</p>
    </body>
</html>

Last updated