<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewportcontent="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <h1>Computed Component</h1>
        <!-- a {{ a }} - b {{ b }} -->
        {{ biodata }}
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>

    <script>
        var vo = new Vue({
            el: '#app',
            data: {
                // a: 1
                nama: "enrico",
                umur: 21,
                // biodata: 'a'
            },
            computed: {
                // b: function () {
                //     return this.a + 2;
                // }
                // biodata: function () {
                //     return this.nama + " umurnya " + this.umur
                // }

                // bisa untuk checkout toko online
                biodata: {
                    get: function () {
                        return this.nama + " umurnya " + this.umur
                    },
                    set: function (params) {
                        var cridential = params.split(' ')
                        this.nama = cridential[0]
                        this.umur = cridential[1]
                    }
                }
            }
        });
    </script>
</body>

</html>