Skip to content

Instantly share code, notes, and snippets.

@ksy90101
Created November 28, 2019 08:48
Show Gist options
  • Save ksy90101/0aa1915852ecd78c990606431b16217c to your computer and use it in GitHub Desktop.
Save ksy90101/0aa1915852ecd78c990606431b16217c to your computer and use it in GitHub Desktop.
[Groom] Vue.js로 시작하는 SPA 개발 - Chapter03
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>[Groom]Vue.js로 시작하는 SPA개발 - Chapter03 - Ex1</title>
<!-- jQuery 추가 -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Vue.js 추가 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<div id = "example">
{{reversedMessage }}
</div>
<script>
let vm=new Vue({
el:"#example",
data:{
message:"Hello"
},
computed:{
reversedMessage : function() {
return this.message.split("").reverse().join("")
// split() : 문자열을 여러개로 나눔
// reverse : 순서를 반전
// join() : 배열의 모든 요소를 연결해 하나의 문자열로 만듦
}
}
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment