2.0.2 • Published 4 years ago
ssr-poster-pc-plugin v2.0.2
ssr-poster-pc-plugin
概述
服务端渲染海报方案,合成插件PC版
使用方法
1、安装
npm install ssr-poster-pc-plugin2、引用
<template>
    <create-poster ref="createPosterRef"/>
</template>
<script>
    import CreatePoster from 'ssr-poster-pc-plugin/CreatePoster';
    export default {
        name: 'test',
        components: {
            CreatePoster
        },
        mounted() {
            const qrcode = 'https://imgcdn.huanjutang.com/assets/img/2020428155511847.jpg';
            const { image, imgProps, qrCodeProps } = {
                image: 'https://imgcdn.huanjutang.com/assets/posters/15919415174372185.png',
                imgProps: {
                    w: 750,
                    h: 1334,
                },
                qrCodeProps: {
                    x: 276,
                    y: 658,
                    size: 199
                }
            };
            this.$refs.createPosterRef.posterCompose(image, qrcode, {
                imgProps,
                qrCodeProps,
            }).then(buff => {
                // buff 图片buffer
            }).catch(() => {
                // 生成失败
            });
        }
    }
</script>