天下无坑

天下无坑


logo

定义示例

// 文件 '@/lib/fabric/src/zGroup/qrcode/qrcode-default.js
import { fabric } from '@/lib/fabric'

const defaultOpts = {
  scheme: 'default',
  name: 'qrcode',
  autoPosition: true,
  top: 0,
  left: 0,
  width: 500,
  height: 200
}

const qrcode = function (datas, options) {
  const { text } = datas
  if (!text || typeof text!=='string' || text.length == 0) return
  const opt =  { ...defaultOpts ,...options }
  const { scheme, name, autoPosition, left, top, width, height } = opt

  // some code...
}

export default qrcode

使用示例

import { fabric } from '@/lib/fabric'

const qrcodeObj = fabric.zGroup.qrcode(datas, options)

数据参数 datas

//options 默认值
{
    text: '文字内容'
}
属性 名称 默认
text 文字内容 “” String

选项参数 options

//options 默认值
{
  name: 'qrcode',
  scheme: 'default',
  autoPosition: true,
  top: 100,
  left: 100,
  width: 200,
  height: 200

}
属性 名称 默认
name fabric对象名 qrcode String
scheme 样式方案名 default String
autoPosition 自动定位 true Boolean
top 顶距 100 Number
left 左距 100 Number
width 200 Number
height 200 Number

页面列表

ITEM_HTML