6 Vue JS 히스토리 대응 (뒤로가기)

source: categories/study/vue-experiance/vue-experiance_5.md

6. Vue JS 히스토리 대응 (뒤로가기)



export default {
    watch: {
        '$route'(to) {
            this.routeName = to.name;
        }
    }
}




export default {
    watch: {
        // '$route'(to, from) {
        '$route'(to) {
            to.name === 'SettingCreateEach' ? this.active = 0 :
                to.name === 'SettingCreateBundle' ? this.active = 1 : null;
        }
    }
}


일단 이렇게 watch 속성을 활용해 해야될듯..
이게 좋은 방법인지는 모르겠으나 뒤로가기 버튼누를시 state(data) 값 관련 이슈 해결됨 - 뒤로가기해도 state(data) 값이 업데이트됨