본문 바로가기
study/Vue

[Vue] 28. vue 예제1 (vueex1.html )

by 금이패런츠 2022. 5. 30.
728x90
반응형

vueex1.html

<!DOCTYPE html>
<!-- 
	/vue1/src/main/webapp/20220530/vueex1.html 
	1. Dynamic Web Project : vue1
	2. webapp 폴더에 20220530 폴더 생성
	3. vue1ex.html 파일 생성
-->
<html>
<head>
<meta charset="UTF-8">
<title>vue 예제 1</title>
<script type="text/javascript" src="https:unpkg.com/vue@2.5.16/dist/vue.js">
</script>
</head>
<body>
<div id="simple" >
	<h2>{{message}}</h2> <!-- {{message}} : 데이터 중 message 데이터의 값 출력 -->
	<input id="a" text="text" v-bind:value="message"> <!-- v-bind:value="message" : 데이터 중 message 데이터의 값 출력-->
	<br>
	<img v-bind:src="imagePath">
	<h3>{{name}}</h3>
	<h3 v-html="name"></h3> <!-- v-html : innerHTML과 연결 -->
</div>

<script type="text/javascript">
	//자바스크립트 객체
	let model = {
			message : "첫번째 Vue.js 예제 : Hello Vue",
			imagePath : "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png",
			name : "홍길동"
	}
	//Vue 객체 생성
	let simple = new Vue({
		el:"#simple", //vue객체 사용 영역 지정
		data : model  //사용 데이터의 객체 설정
	})
</script>
</body>
</html>
728x90
반응형