getData
说明
getData
用于获取当前画图内容的数据。
参数
{object}
options
选项,非必填{boolean}
options.compact
压缩,非必选
返回值
{object}
data
图画的JSON
对象数据
用法
js
import { iDraw } from 'idraw';
const data = {
elements: [
{
name: 'rect',
x: 160,
y: 120,
w: 200,
h: 100,
angle: 30,
type: 'rect',
detail: {
background: '#d5f5f9',
borderRadius: 10,
borderWidth: 2,
borderColor: '#3f51b5'
}
}
]
};
const app = document.querySelector('#app');
const options = {
width: 600,
height: 400,
devicePixelRatio: 2
};
const idraw = new iDraw(app, options);
idraw.setData(data);
const resultData = idraw.getData();
console.log(resultData);