@adamlacombe/fa-icon 中文文档教程

发布于 4 年前 浏览 8 项目主页 更新于 2 年前

Built With Stencil

@adamlacombe/fa-icon

A web component for Font Awesome 5

在 codepen.io 上查看它的运行情况

Examples

TSX

import { Component, h, Host } from '@stencil/core';
import '@adamlacombe/fa-icon';

@Component({
  tag: 'my-component'
})
export class MyComponent {

  render() {
    return <Host>
      <fa-icon type={'far'} name={'surprise'} size={'medium'} />
    </Host>;
  }
}

HTML

<script src='https://unpkg.com/@adamlacombe/fa-icon@latest/dist/fa-icon.js'></script>

<fa-icon type="far" name="surprise" size="medium"></fa-icon>

Using this component

Script tag

  • Put a script tag similar to this <script src="https://unpkg.com/@adamlacombe/fa-icon@latest/dist/fa-icon.js"></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

In a stencil project

  • Run npm install @adamlacombe/fa-icon --save
  • Add an import to the npm package import '@adamlacombe/fa-icon';
  • Then you can use the element anywhere in your stencil project.

Built With Stencil

@adamlacombe/fa-icon

A web component for Font Awesome 5

See it in action on codepen.io

Examples

TSX

import { Component, h, Host } from '@stencil/core';
import '@adamlacombe/fa-icon';

@Component({
  tag: 'my-component'
})
export class MyComponent {

  render() {
    return <Host>
      <fa-icon type={'far'} name={'surprise'} size={'medium'} />
    </Host>;
  }
}

HTML

<script src='https://unpkg.com/@adamlacombe/fa-icon@latest/dist/fa-icon.js'></script>

<fa-icon type="far" name="surprise" size="medium"></fa-icon>

Using this component

Script tag

  • Put a script tag similar to this <script src="https://unpkg.com/@adamlacombe/fa-icon@latest/dist/fa-icon.js"></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

In a stencil project

  • Run npm install @adamlacombe/fa-icon --save
  • Add an import to the npm package import '@adamlacombe/fa-icon';
  • Then you can use the element anywhere in your stencil project.
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文