Appearance
Wxml2Json
将 wxml 转换为 painter json 配置
See
Constructors
constructor
• new Wxml2Json(options?
): Wxml2Json
参数
Name | Type | Description |
---|---|---|
options | Object | |
options.background | string | 背景颜色 |
options.context | any | 组件实例 |
options.height | number | 高度 |
options.width | number | 宽度 |
返回值
示例
ts
const drawImage = new Wxml2Json({
width: 200,
height: 200,
context: instance,
background: '#ffffff',
})
drawImage.draw({
container: '.container',
className: '.node',
})
源码
Methods
draw
▸ draw(params
): any
绘制方法,获取 json 配置
参数
Name | Type | Description |
---|---|---|
params | Object | |
params.background | string | 背景颜色 |
params.height | number | 高度 |
params.width | number | 宽度 |
返回值
any
json 配置