<!-- webview only --><!-- slot -->
<template>
    <div class="bl___follow-container" @click="handleClick">
        <slot></slot>
    </div>
</template>

<script>
export default {
    props: {
        follow: Boolean,
        default: false,
    },
    data() {
        return {
            followed: false,
        }
    },
    created() {
        SmallApp.registerNativeComponentOfKind('follow', this);
    },
    beforeDestroy() {
        const options = {
            name: 'follow',
            id: this._uid,
            destroy: true,
        };
        SmallApp.nativeComponent(options);
        SmallApp.destroyNativeComponentOfKind('follow', this);
    },
    methods: {
        handleClick() {
            const options = {
                name: 'follow',
                id: this._uid,
                destroy: false,
                follow: !this.follow
            };
            SmallApp.nativeComponent(options);
            this.$emit('click');
        },
        handleMessage(message) {
            if (message.type === 'native-component') {
                switch (message.event.type) {
                    case 'status': {
                        this.$emit('follow', message.event);
                    }
                }
            }
        }
    }
}
</script>

<style>
</style>
