<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Parameter</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
    <script src="assets/lib/vue/vue.min.js"></script>
    <link rel="stylesheet" href="assets/css/common.css" type="text/css"/>
    <link rel="stylesheet" href="assets/css/header.css" type="text/css"/>
    <link rel="stylesheet" href="assets/css/piece.css" type="text/css"/>
</head>
<body>
<div id="app" v-cloak>
    <div class="header">
        <div class="btn" @click="onClickBack"><img class="icon" src="assets/icons/left.svg"></div>
        <div class="text">{{ lang.title }}</div>
        <div class="btn"></div>
    </div>
    <div class="content">
        <div class="settings">
            <div class="piece">
                <div class="piece-title">{{ lang.screen_info }}</div>
                <div class="piece-items">
                    <a class="piece-item">
                        <div class="piece-item-content">
                            <div class="piece-item-key">{{ lang.screen_width }}</div>
                            <div class="piece-item-val">{{ phone.width }}</div>
                        </div>
                    </a>
                    <a class="piece-item">
                        <div class="piece-item-content">
                            <div class="piece-item-key">{{ lang.screen_height }}</div>
                            <div class="piece-item-val">{{ phone.height }}</div>
                        </div>
                    </a>
                    <a class="piece-item">
                        <div class="piece-item-content">
                            <div class="piece-item-key">{{ lang.screen_rate }}</div>
                            <div class="piece-item-val">{{ phone.rate }}</div>
                        </div>
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>

<script>
    var app = new Vue({
        "el": "#app",
        "data": {
            lang: {
                title           : "同屏参数",
                screen_info     : "屏幕信息",
                screen_width    : "宽度",
                screen_height   : "高度",
                screen_rate     : "帧率",
            },
            phone: {
                width   : "",
                height  : "",
                rate    : "",
            }
        },
        "created": function () {
            if (typeof ($android) !== "undefined") {
                //加载语言
                this.lang = Object.assign(this.lang, JSON.parse($android.onGetLang()));
                //加载数据
                var data = JSON.parse($android.onGetData());
                this.phone = Object.assign(this.phone, data.phone);
            }
        },
        "methods": {
            onClickBack: function(){
                if(typeof($android) == "undefined"){
                    location.href = "index.html"
                    return;
                }
                $android.onClickBack();
            }
        }
    })
</script>