LoveIt/layouts/shortcodes/echarts.html
Dillon f14301c395
feat: improve configuration (#245)
* feat: improve configuration

* fix: fix partials/footer.html error
2020-04-21 22:55:06 +08:00

6 lines
497 B
HTML

{{- $content := .Inner | transform.Unmarshal | jsonify -}}
{{- $id := partial "function/id.html" (dict "content" $content "scratch" .Page.Scratch) -}}
{{- $width := cond .IsNamedParams (.Get "width") (.Get 0) | default "100%" -}}
{{- $height := cond .IsNamedParams (.Get "height") (.Get 1) | default "30rem" -}}
<div class="echarts" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
{{- dict "echarts" true | merge (.Page.Scratch.Get "this") | .Page.Scratch.Set "this" -}}