<!-- renderjs 逻辑层 -->
<script>
    import { nanoid } from 'nanoid'

    export default {
        emits: ['register'],
        data() {
            return {
                id: nanoid(),
                option: {},
            }
        },
        mounted() {
            this.$emit('register', this)
        },
        methods: {
            setOption(option) {
                this.option = {
                    id: this.id,
                    ...option,
                }
            },
        },
    }
</script>

<!-- renderjs 视图层模块 -->
<script module="echarts" lang="renderjs" src="./echarts.module.js"></script>

<template>
    <!-- #ifdef APP-PLUS || H5 -->
    <view class="wrap echarts" :id="id" :option="option" :change:option="echarts.changeOption" />
    <!-- #endif -->
    <!-- #ifndef APP-PLUS || H5 -->
    <view class="wrap empty">非 APP、H5 环境不支持</view>
    <!-- #endif -->
</template>

<style lang="less" scoped>
    //
</style>
