react-web-component icon indicating copy to clipboard operation
react-web-component copied to clipboard

How to support attributes with array ?

Open xQuotes opened this issue 4 years ago • 0 comments

We have swiper component like

<Swiper items={[
   {
      src: 'img url'
   },
  {
      src: 'img url2'
   }
]} />

Now we change it to web-components

import { YYSwiper } from './Swipper';
import ReactWebComponent from 'react-web-component';
ReactWebComponent.create(<YYSwiper />, 'web-swiper');

And use like

<web-swiper
  vertical="false"
  items="[{\"src\"=\"\"}, {\"src\"=\"\"}]"
></web-swiper>

I need to JSON.parse(items) in ./Swipper'

xQuotes avatar Sep 10 '21 09:09 xQuotes