vue#mergeProps JavaScript Examples

The following examples show how to use vue#mergeProps. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: createIcon.js    From dls-icons with MIT License 6 votes vote down vote up
export default function createIcon({ name, content, width, height }) {
  return {
    name,
    inheritAttrs: false,
    props: {
      spin: Boolean,
    },
    setup(props, { attrs }) {
      const iconClasses = [baseClassName]

      if (props.spin) {
        iconClasses.push(`${baseClassName}-spin`)
      }

      return () =>
        h(
          'svg',
          mergeProps(
            {
              class: iconClasses,
              width,
              height,
              viewBox: `0 0 ${width} ${height}`,
              focusable: attrs.tabindex !== '0' ? 'false' : null,
              innerHTML:
                (attrs.title
                  ? `<title>${escapeHTML(attrs.title)}</title>`
                  : '') + content,
            },
            attrs
          )
        )
    },
  }
}