• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    미해결

this.$root.$data.turn 작동하지를 않습니다..ㅠㅠ

21.02.07 20:44 작성 조회수 265

0

undefined

TdComponent.vue?c5a7:15 {__ob__: Observer}

TdComponent.vue?c5a7:16 {__ob__: Observer}

TdComponent.vue?c5a7:17 undefined

vue.esm.js?efeb:628 [Vue warn]: Error in v-on handler: "TypeError: Cannot read property '1' of undefined"

found in

---> <TdComponent> at src/components/molecules/TdComponent.vue

       <TrComponent> at src/components/molecules/TrComponent.vue

         <TableComponent> at src/components/oranlsms/TableComponent.vue

           <TicTacToe> at src/components/TicTacToe.vue

             <App> at src/App.vue

               <Root>

warn @ vue.esm.js?efeb:628

logError @ vue.esm.js?efeb:1893

globalHandleError @ vue.esm.js?efeb:1888

handleError @ vue.esm.js?efeb:1848

invokeWithErrorHandling @ vue.esm.js?efeb:1871

invoker @ vue.esm.js?efeb:2188

original._wrapper @ vue.esm.js?efeb:7565

vue.esm.js?efeb:1897 TypeError: Cannot read property '1' of undefined

    at VueComponent.onClickTd (TdComponent.vue?c5a7:19)

    at invokeWithErrorHandling (vue.esm.js?efeb:1863)

    at HTMLTableCellElement.invoker (vue.esm.js?efeb:2188)

    at HTMLTableCellElement.original._wrapper (vue.esm.js?efeb:7565)

logError @ vue.esm.js?efeb:1897

globalHandleError @ vue.esm.js?efeb:1888

handleError @ vue.esm.js?efeb:1848

invokeWithErrorHandling @ vue.esm.js?efeb:1871

invoker @ vue.esm.js?efeb:2188

original._wrapper @ vue.esm.js?efeb:7565

제로초님 안녕하세요.. ㅠㅠ 

this.$root.$data.turn  작동하지를 않습니다..ㅠㅠ

답변 4

·

답변을 작성해보세요.

0

main.js 코드를 다음과 같이 바꿔보세요.

import Vue from 'vue';
import TicTacToe from './TicTacToe';

new Vue(TicTacToe).$mount('#root');

0

똑같은 에러라서... 제가 뭔가 잘못하고 있는건가요?

0

위에는 선생님 깃허브에서 다운받아서 작동해봤구요... 밑에는 

this.$root.$data가 들어오지를 않습니다...

  1. {__ob__: Observer}
    1. __ob__Observer
      1. vmCount1
TdComponent.vue?c5a7:15
  1. <slot style="box-sizing:border-box;min-width:0px;min-height:0px"><span class="console-object console-object-preview" tabindex="-1" style="box-sizing:border-box;min-width:0px;min-height:0px;white-space:pre-wrap;overflow-wrap:break-word;font-style:italic;word-break:break-all"><span class="object-properties-preview" style="box-sizing:border-box;min-width:0px;min-height:0px">{<span class="name" style="box-sizing:border-box;min-width:0px;min-height:0px;color:#a9a9a9;flex-shrink:0">__ob__</span>: <span class="object-value-object" style="box-sizing:border-box;min-width:0px;min-height:0px">Observer</span>}</span><span class="object-state-note info-note" style="box-sizing:border-box;min-width:0px;min-height:0px;background-color:#99aaff;display:inline-block;width:11px;height:11px;color:black;text-align:center;border-radius:3px;line-height:13px;margin:0px 6px;font-size:9px"></span></span></slot>
    1. parant(...)

도저히 못찾겠어요.. 건너뛰어야 할까요?

0

1 of undefined라는데 x[1]이 있다면 x가 undefined인 것입니다. 왜 x가 undefined인지 console.log로 추적해보세요.