<template>
    <div class="version">
    </div>
</template>

<script>
export default {
    data() {
        return {
            version: null,
        }
    },
    methods: {
        // 比较版本
        check() {
            // alert(this.version);

            let arr = this.version.split(".");
            if (
                arr[0] * 1 > 5 ||
                (arr[0] * 1 == 5 && arr[1] * 1 > 2) ||
                (arr[0] * 1 == 5 && arr[1] * 1 == 2 && arr[2] * 1 >= 8)
            ) {
                // alert(123)
            } else {
                // alert(456)
            }
        },
        getVersion(res) {
            this.version = res;
            this.check();
        },
    },
    created() {
        // alert(this.$route.query.name)
        //获取当前版本号
        if (window.android !== undefined) {
            this.version = window.android.getVersion();
            this.check();
        } else {
            window.webkit &&
                window.webkit.messageHandlers.getVersion.postMessage("getVersion");
        }
    },
    mounted() {
        window.getVersion = this.getVersion;
    },
}
</script>

<style>

</style>