일일일코_장민기 2024. 3. 6. 13:11
728x90
HelloWorld.vue
<template>
  <div>
    {{mesg}}<br>
    {{ username }}<br>
    {{ age }}<br>
    {{ sayEcho() }}<br>
    {{ info() }}
  </div>
</template>

<script>
export default {
    props:{
        mesg: String
    },
    data:function(){
        return {
            username: "홍길동",
            age: "20"
        }
    },
    methods: {
        sayEcho: function(){
            console.log("sayEcho");
            return this.username + "\t" + this.age;
        },
        info: () => {
            console.log("info "+this);  //this는 undefinded
            return this;
        }
       
    },


}
</script>

<style>

</style>