小程序生成图片库Painter的Wepy版本
npm install painter-wepy --save
import painter from 'painter-wepy'
<script>
<template lang="wxml" minapp="wepy">
<painter :palette.sync="palette" @imgOK.user="onImgOK" />
</template>
</script>
import wepy from 'wepy';
import painter from 'painter-wepy'
export default class Index extends wepy.page {
components = {
painter,
};
data = {
palette: {
{
width: '654rpx',
height: '1000rpx',
background: '#eee',
views: [
{
type: 'text',
text: 'borderWidth',
css: {
bottom: '40rpx',
right: '200rpx',
color: 'green',
borderWidth: '2rpx',
}
}
]
}
}
}
methods = {
onImgOK(e) {
this.imgUrl = e.path
this.$apply();
}
}
}