Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

페이지 115쪽 예제 코드 에러 확인 요청 #15

Closed
vljh246v opened this issue Apr 11, 2020 · 2 comments
Closed

페이지 115쪽 예제 코드 에러 확인 요청 #15

vljh246v opened this issue Apr 11, 2020 · 2 comments

Comments

@vljh246v
Copy link

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <my-component></my-component>
        <your-component></your-component>
    </div>
    
    <script src="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>`
        })

        new Vue({
            el: '#app',
            data: {
                message: 'click this button'
            }
        })
    </script>
</body>
</html>

위 코드를 통해 HTML 파일에서 뷰 코드 작성 시의 한계점을 설명하셨습니다.

해당 코드에서 'your-component' 내부에서 message 데이터를 사용하고 있습니다.
해당부분은 props 를 활용해서 데이터를 받아와야 하는게 아닐까요?
다만 실제 책에서는 윗부분 코드를 '...'을 통해 생략하고 있어서
다른 코드가 있다면 동작할 수도 있지만
단편적인 예제를 보면 에러라고 예상할 수가 있을것 같습니다.

또한 실제 위 코드를 돌려보면 에러가 발생하고 있습니다.
확인 부탁드립니다.

@vljh246v
Copy link
Author

05-2 장 뷰 프로젝트 구성 방법 초입부분입니다.

@vljh246v
Copy link
Author

그냥 복잡하다라고 설명하시는 용도였다면 그렇게 이해하도록 하겠습니다~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant