본문 바로가기

svelte/part1: basic svelte

[introduction] HTML tags

문자열 변수에 들어있는 HTML태그를 렌더링하여 출력하려면 변수명 앞에 @html 을 입력합니다.

 

<script>
	let string = `이 문자열 변수에는 HTML이 포함되어 있습니다. <strong>굵은 문자로 출력</strong>`;
</script>

<p>{@html string}</p>

 

'svelte > part1: basic svelte' 카테고리의 다른 글

[reactivity] assignments  (0) 2023.10.27
[introduction] Nested components  (0) 2023.10.27
[introduction] Styling  (0) 2023.10.27
[introduction] Dynamic attributes  (0) 2023.10.27
[introduction] Your first components  (0) 2023.10.27