1.0.2 • Published 3 years ago

uniapp-poster v1.0.2

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

npm下载安装

$ npm install uniapp-poster --save
  "easycom": {
    "autoscan": true,
    "custom": {
      "^uniapp-(.*)": "uniapp-poster/main.vue"
    }
  }

2.import + components

使用

  <view>
    <uniapp-poster canvasId="xxx" className="xxx" ref="xxx"/>
    或
    <uniapp-poster ref="xxx">
      // 自定义其他内容
      <view>
        ... 
      </view>
    </uniapp-poster>
  </view>

事件 event

名称类型说明
onShowPosterfunction(options: object)画布显示事件
onSavePosterfunction(callback: function)海报保存事件
clostPosterfunction关闭海报事件

示例

  // 调用
  <uniapp-poster ref="poster"/>

  // 事件
  this.$refs.poster.onShowPoster({
    cWidth: 355,
    cHeight: 550,
    // autoSize: true,
    // scaling: 2,
    // autoImg: 'https://xls-static.sibumbg.cn/9a578ea8c4df4875bdf03c990bf9703a.png',
    downFileList: [
      {
        key: 'bgImg', // 对应params子元素key
        url: 'https://xls-static.sibumbg.cn/9a578ea8c4df4875bdf03c990bf9703a.png'
      }
    ],
    params: [
      {
        x:0,
        y:0,
        width: '100%',
        height: '100%',
        type: 'image',
        key: 'bgImg'
      },
      {
        x:10,
        y:50,
        type: 'text',
        text: '我是单行文字',
        fillStyle: '#333',
        fontSize: 12
      },
      {
        x: 10,
        y: 80,
        type: 'text',
        text: '我是换行文字',
        width: 20,
        fillStyle: '#333',
        isLineFeed: 1,
        fontSize: 20
      },
      {
        x: 50,
        y: 100,
        width: 120,
        height: 120,
        type: 'image',
        key: 'qrCode',
        url: 'https://img0.baidu.com/it/u=3311900507,1448170316&fm=26&fmt=auto&gp=0.jpg'
      },
      {
        x: 50,
        y: 250,
        type: 'rect',
        width: 100,
        height: 100,
        radius: 10,
        fillColor: '#6D5289'
      },
    ]
  })

  // style
  .myPoster .poster{
    ...
  }
}
1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.45

3 years ago