Skip to content

Any way to use special characters inside components? #1179

@didiraja

Description

@didiraja

Components docs, says props objects should be encoded.

I have a dynamic object that could have special characters in some keys. How is the best way to send this values as props on a component, without needing to remove the characters?

Example:

  • data
[{
  "product": "Lorem TV 15'' LED",
  "link": "http://link.to/product",
},
{
  "product": "Ipsum Airfryer",
  "link": "http://link.to/product-2",
}]
  • template
<each loop="item in {{page.data}}">
  <x-link data={{item}} />
</each>
  • x-link component
<script props>
  module.exports = {
    data: props.data
  }
</script>

<a href={{data.link}}>{{data.product}}</a>

Airfryer renders normally, but TV don't, it breaks after apostrophe. Tried using html entities but it just don't render and unicode \u0027 also breaks on render, although other unicodes works as \u00a0 and \u00e2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions