# v-html

## Vue HTML 출력

`v-html`을 이용하여 태그 내부 HTML(innerHTML)을 설정할 수 있다. 단, 기존에 작성된 내용은 사라지므로 사용 시 주의해야 한다.

```html
<태그 v-html="데이터"></태그>
```

### 사용 예제

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Welcome to Vue JS 3</title>
</head>
<body>
    <div id="app">
        <input type="text" v-model="message">
        <div v-html="message"></div>
    </div>

    <script src="https://unpkg.com/vue@next"></script>
    <script>
        const app = Vue.createApp({
            data(){
                return {
                    message : "<h1>Hello VueJS!</h1>"
                };
            }
        });
        app.mount("#app");
    </script>
</body>
</html>
```

{% embed url="<https://codepen.io/hiphop5782/pen/bGYorxN>" %}

{% hint style="info" %}
`v-html`은 HTML이 해석되기 때문에 의도적으로 이용할 수 있다. 따라서 출력하는 데이터에 사용자가 개입할 수 없도록 구성하는 것이 중요하다.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sysout.co.kr/web/develop-page/js/vuejs/cdn-vue3/vue-directive/v-html.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
