From bf311a0dee923a659530b09eb7e24e4c23bba905 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Wed, 1 Mar 2023 07:39:58 +0100 Subject: [PATCH] display shortcode with parameter 'expr' --- exampleSite/content/app/test1.md | 2 +- layouts/shortcodes/pv/display.html | 3 ++- layouts/shortcodes/pv/input-textline.html | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/exampleSite/content/app/test1.md b/exampleSite/content/app/test1.md index ba93480..ce07321 100644 --- a/exampleSite/content/app/test1.md +++ b/exampleSite/content/app/test1.md @@ -17,4 +17,4 @@ cyberscopes example site - use petite-vue in Hugo-generated sites. {{< pv/input-textline name="firstname" >}} {{< pv/input-textline name="lastname" >}} -{{< pv/display name="firstname" >}} +{{< pv/display expr="`${data.firstname} ${data.lastname}`" >}} diff --git a/layouts/shortcodes/pv/display.html b/layouts/shortcodes/pv/display.html index da508a5..93ecef6 100644 --- a/layouts/shortcodes/pv/display.html +++ b/layouts/shortcodes/pv/display.html @@ -1,5 +1,6 @@ +{{- $expr := .Get "expr" | default "data" -}}
-

+  

 
diff --git a/layouts/shortcodes/pv/input-textline.html b/layouts/shortcodes/pv/input-textline.html index 0fa3cf5..470e4ef 100644 --- a/layouts/shortcodes/pv/input-textline.html +++ b/layouts/shortcodes/pv/input-textline.html @@ -1,7 +1,7 @@ {{- $name := default "textline" (.Get "name") }}
+ v-model="data.{{ $name }}" + @vue:mounted="data.{{ $name }} = ''" + @change="save()" />