Giter Club home page Giter Club logo

eeui-plugin-screenshots's Introduction

组件截图

安装

eeui plugin install https://github.com/aipaw/eeui-plugin-screenshots

卸载

eeui plugin uninstall https://github.com/aipaw/eeui-plugin-screenshots

引用

const screenshots = app.requireModule("eeui/screenshots");

截图功能

screenshots.shots 截图功能,传入ref,即可得到组件的截图

/**
 * @param ref       组件的ref
 * @param callback  回调事件
 */
screenshots.shots(ref, callback(result))

ref 参数说明
属性名 类型 必须 描述 默认值
ref Object vue对象 -
callback 回调result说明
{
    status: 'success',   //状态:success、error
    path: ''          //图片路径
    msg: ''           //详细消息
}

简单示例
<template>
    <div class="app">
        <div ref="main" class="main">
            <image class="img" :src="img"></image>
            <text class="txt">{{src}}</text>
            <button class="button" text="截屏" @click="shots"></button>
        </div>
    </div>
</template>
<style>
    .app{align-items:center;justify-content:center}
    .main{align-items:center;justify-content:center}
    .txt{font-size:22px;margin-bottom:20px}
    .img{width:300px;height:400px;margin-bottom:20px;background-color:red}
    .button{font-size:24px;margin-left:37px;margin-right:37px;margin-bottom:20px;width:300px;height:80px}
</style>
<script>
    export default {
        data() {
            return {
                src: '',
                img: ''
            }
        },
        methods: {
            shots() {
                let screenshots = app.requireModule('screenshots');
                screenshots.shots(this.$refs.main, (p) => {
                    if (p.status == 'success') {
                        this.src = p.path;
                        this.img = "file://" + p.path + "?r=" + Math.random();
                    }
                });
            }
        }
    }
</script>

eeui-plugin-screenshots's People

Contributors

aipaw avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

eeui-plugin-screenshots's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.