Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

组件 style 跟 script 加载 #21

@ponkans

Description

@ponkans

magic 组件如果有自己的样式,或者脚本文件,可以通过 magic 函数第三个字段中的 styles 跟 scripts 进行加载。建议完善 readme.md

magic('my-component', MyModule, {
  propTypes: {
    id: Number,
    test: Boolean,
    callback: Function,
    count: Number,
  },
  // 样式文件
  styles: ['https://xxx.a.css', 'https://xxx.b.css'],
  // js 资源
  scripts: ['https://xxx.a.js', 'https://xxx.b.js']
});

样式跟脚本文件,magic 会插入到 webcomponents 内部
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions