You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title></head><body><divid="app"><my-component></my-component><your-component></your-component></div><scriptsrc="https://cdn.jsdelivr.net/npm/vue@2.5.2/dist/vue.js"></script><script>Vue.component('my-component',{template: `<div><h5>complex markup</h5><ul><li><button>can you figure this syntax out? </button></li><li><p style="color:blue;">this is the second list item</p></li><li> <strong>continue on adding more items</strong></li></ul></div>`})Vue.component('your-component',{template:`<div><span style="font-size:1.2em;"><button>{{ message }}</button></span> </div>`})newVue({el: '#app',data: {message: 'click this button'}})</script></body></html>
위 코드를 통해 HTML 파일에서 뷰 코드 작성 시의 한계점을 설명하셨습니다.
해당 코드에서 'your-component' 내부에서 message 데이터를 사용하고 있습니다.
해당부분은 props 를 활용해서 데이터를 받아와야 하는게 아닐까요?
다만 실제 책에서는 윗부분 코드를 '...'을 통해 생략하고 있어서
다른 코드가 있다면 동작할 수도 있지만
단편적인 예제를 보면 에러라고 예상할 수가 있을것 같습니다.
또한 실제 위 코드를 돌려보면 에러가 발생하고 있습니다.
확인 부탁드립니다.
The text was updated successfully, but these errors were encountered:
위 코드를 통해 HTML 파일에서 뷰 코드 작성 시의 한계점을 설명하셨습니다.
해당 코드에서 'your-component' 내부에서 message 데이터를 사용하고 있습니다.
해당부분은 props 를 활용해서 데이터를 받아와야 하는게 아닐까요?
다만 실제 책에서는 윗부분 코드를 '...'을 통해 생략하고 있어서
다른 코드가 있다면 동작할 수도 있지만
단편적인 예제를 보면 에러라고 예상할 수가 있을것 같습니다.
또한 실제 위 코드를 돌려보면 에러가 발생하고 있습니다.
확인 부탁드립니다.
The text was updated successfully, but these errors were encountered: