0.0.5 • Published 3 years ago

taro3-svg v0.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

taro3项目使用方式

  • 复制组件(cax-svg目录)到自己项目的components目录下
  • 修改components/cax-svg/index.js文件中的cax引入
// import cax from './cax'
import cax from 'taro3-svg'
  • 页面的配置文件(xxx.config.js)中使用useComponents引入该组件
  usingComponents:{
    'taro-svg': '../../components/cax-svg/index'
  }
  • 引入html和renderSVG到页面中,按照以下方式使用(renderSVG方法调用场景根据自己需求使用,以下场景是在页面加载后调用)
  import { html, renderSVG } from 'taro3-svg'
  componentsDidmount () {
    // 静态svg使用
    renderSVG(html`要渲染的svg代码`,'svg',Taro.getCurrentInstance().page)
    // 动态svg使用
    const svgHtml = {
      type: 'svg',
      props: {
        width: 100,
      },
      childrens: [
        {
          type: 'path',
          ......
        }
      ]
    }
    renderSVG(svgHtml,'svg',Taro.getCurrentInstance().page)
  }
  render() {
    <taro-svg id='svg'></taro-svg>
  }
0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago