about the use of setAttributes
Question
hi,I saved an object in the custom property。
And I want to implement putting values into custom properties。
but It will cover the previous one

Answers (3)
so, in the second case do you want to update the same data-info attribute with a new key, right?
since data-info has a string as a type value, first you need to get it and parse to an object.
const dataInfoObject = JSON.parse(this.model.get('data-info'))
after that, you can update the object with the new key
dataInfoObject[newKey] = newValue
and then you change it back to string and replace the attribute value for your model
this.model.set('data-info', JSON.stringfy(dataInfoObject))
let me know if it works
I thinks he's just looking for addAttributes
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1184
Is it possible to have only one button in the canvas
hi,bro。I want to implement that there is only one button in the canvas.when i drag the second,it will not be placed correctly or the button...
Issue #1299
Add a new trait
hi,sorry,My English is poor. I want to add a new trait for a block . how should i do it? for example: add a trait about xaxis for the chart.
Issue #1305
About changing the configuration items on the chart
Sorry, there's a problem that's been bothering me。 I created a component for chart. I write configuration items in script And I want the us...
Issue #1376
about the path of the styles
hi,i want to know the path of the styles. i want to use local css,and the local directory structure is as follows . I tried many times and...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.