use message field 'class' for identifying component
This commit is contained in:
parent
7456271782
commit
80626c3d01
2 changed files with 5 additions and 4 deletions
|
@ -73,9 +73,9 @@ function poll() {
|
||||||
|
|
||||||
function handle(msg) {
|
function handle(msg) {
|
||||||
const data = JSON.parse(msg.payload)
|
const data = JSON.parse(msg.payload)
|
||||||
for (const k of Object.keys(data)) {
|
const [ domain, action, class_, item ] = msg.path.split('/')
|
||||||
this.components.data.data[k] = data[k]
|
//console.log('msgbase: ', domain, action, class_, item)
|
||||||
}
|
Object.assign(this.components[class_].data, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// basic functions - move to api.ts
|
// basic functions - move to api.ts
|
||||||
|
|
|
@ -22,7 +22,8 @@ cyberscopes example site - use petite-vue in Hugo-generated sites.
|
||||||
Email: {{< pv/input-textline name="email" default="hm@cy55.de" >}}
|
Email: {{< pv/input-textline name="email" default="hm@cy55.de" >}}
|
||||||
{{< pv/button >}}
|
{{< pv/button >}}
|
||||||
|
|
||||||
{{< pv/display expr="`${data.firstname} ${data.lastname}`.trim() || '???'" >}}
|
{{< pv/display linkto="data.id"
|
||||||
|
expr="`${data.firstname} ${data.lastname}`.trim() || '???'" >}}
|
||||||
|
|
||||||
{{< pv/display name="id" linkto="data.id" >}}
|
{{< pv/display name="id" linkto="data.id" >}}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue