I'm trying to set an extra css class for my object. In my props I have
customClass: {
type: Object,
default: function () {
return {};
},
},
and I'm trying to set my customClass (custom-class) in my PHP code as such:
$('.ac-col-12.tokenizer-wrapper')
.append('<tokenizer-wrapper :value=\'<?= json_encode($visit['tags']) ?>\' ' +
'custom-class=\'{tag-visit}\''+
'term=\'search\' label=\'<?= t('Tags'); ?>\' position=\'top\'>' +
"</tokenizer-wrapper>");
But I'm not passing the custom-class as a correct object so I'm receiving:
[Vue warn]: Invalid prop: type check failed for prop "customClass". Expected Object, got String.
How can I send the custom-class as object? suggestions?
:on yourcustom-classattribute in theappend()call.{tag-visit}isn't a valid JS object. Try replacing it with a valid object.{x: 1}is a valid object. Maybe you meant to say something like{"tag-visit": "somevalue"}?