diff --git a/assets/js/common.ts b/assets/js/common.ts index f82fed1..9b8b45a 100644 --- a/assets/js/common.ts +++ b/assets/js/common.ts @@ -15,18 +15,6 @@ export function config (api, polling): confdata { return { apiurl: api.path, pollurl: pu, itemid: urlparams.get('id') } } -const appdata = { - $delimiters: ['{|', '|}'], - conf: {} as confdata, - data: {}, - output: '', - save, - poll, - mounted(name: string) { - console.log('app mounted: ', name) - } -} - export const pvapp = { run(conf: confdata) { appdata.conf = conf @@ -37,6 +25,18 @@ export const pvapp = { } } +const appdata = { + $delimiters: ['{|', '|}'], + conf: {} as confdata, + output: '', + poll, + mounted(name: string) { + console.log('app mounted: ', name) + }, + Data +} + + // components function Data() { @@ -46,7 +46,7 @@ function Data() { } } -// appdata method definitions +// appdata and component method definitions function save() { let value = '' diff --git a/exampleSite/content/app/test1.md b/exampleSite/content/app/test1.md index 54bd6ff..66b485a 100644 --- a/exampleSite/content/app/test1.md +++ b/exampleSite/content/app/test1.md @@ -5,7 +5,7 @@ img: pageid: test1 domains: [App] topics: [Examples] -date: 2023-03-01 +date: 2023-03-02 author: helmutm draft: false weight: 10 @@ -14,12 +14,17 @@ jsModule: main.ts cyberscopes example site - use petite-vue in Hugo-generated sites. -{{< pv/input-textline name="firstname" attrs="autofocus" >}} -{{< pv/input-textline name="lastname" >}} -{{< pv/button >}} +{{< pv/fieldset >}} -{{< pv/display expr="`${data.firstname} ${data.lastname}`.trim() || '???'" >}} + {{< pv/input-textline name="firstname" attrs="autofocus" >}} + {{< pv/input-textline name="lastname" >}} + {{< pv/button >}} -{{< pv/display name="email" >}} + {{< pv/display expr="`${data.firstname} ${data.lastname}`.trim() || '???'" >}} + + {{< pv/display name="email" >}} + +{{< /pv/fieldset >}} {{< pv/debug >}} + diff --git a/layouts/shortcodes/pv/debug.html b/layouts/shortcodes/pv/debug.html index 730fe7b..15cf08c 100644 --- a/layouts/shortcodes/pv/debug.html +++ b/layouts/shortcodes/pv/debug.html @@ -1,8 +1,11 @@