Skip to content

Commit

Permalink
첫 커밋 합니다.
Browse files Browse the repository at this point in the history
  • Loading branch information
hye5nee123 committed Feb 1, 2024
1 parent 3ce5201 commit 0574ad0
Show file tree
Hide file tree
Showing 16 changed files with 430 additions and 17 deletions.
23 changes: 22 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
},
"dependencies": {
"core-js": "^3.8.3",
"vue": "^3.2.13"
"vue": "^3.2.13",
"vue-router": "^4.0.3"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3"
Expand Down
3 changes: 3 additions & 0 deletions public/pilgi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//랜더링은 주로 뷰(View)를 사용자에게 표시하는 과정을 일반적으로 설명할 때 사용되며, 마운트는 Vue 인스턴스를 생성하고 실제 DOM에 연결하여 화면에 나타내는 초기 과정을 설명할 때 사용됩니다.

//컴포넌트란
33 changes: 19 additions & 14 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
<template>
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<nav>
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link> |
<router-link to="/binding"> 데이터 바인딩</router-link>
</nav>
<router-view/>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
HelloWorld
}
}
</script>

<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
nav {
padding: 30px;
}
nav a {
font-weight: bold;
color: #2c3e50;
}
nav a.router-link-exact-active {
color: #42b983;
}
</style>
3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'

createApp(App).mount('#app')
createApp(App).use(router).mount('#app')
31 changes: 31 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import DataBinding from '../views/ComputedVue.vue'

const routes = [
{
path: '/',
name: 'home',
component: HomeView
},
{
path:'/binding',
name:'binding',
component: DataBinding
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
}
]

const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})

export default router
5 changes: 5 additions & 0 deletions src/views/AboutView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>
28 changes: 28 additions & 0 deletions src/views/ComputedVue.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<div>
<h1>{{ `${this.lastName} ${this.firstName}` }}</h1>
<h1>{{ `${fullName}` }}</h1>
</div>
<input type="text" v-model="lastName">
<input type="text" v-model="firstName">
</template>
<script>
export default {
data() {
return {
firstName: 'kildong',
lastName: 'Hong'
}
},
computed: {
fullName() {
return `${this.lastName} ${this.firstName}`
}
},
watch: { //변경이전, 이후.
firstName(curr,bef){
console.log(curr,bef);
}
}
}
</script>
21 changes: 21 additions & 0 deletions src/views/DataBinding.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<h3>Hello,{{msg}}</h3>>
<div>{{htmlStr}}</div>
<div v-html="htmlStr"></div>
<input type="text" v-model="vmodel"/>
<p>{{vmodel}}</p>
<textarea cols="30" rows="10" v-model="message"></textarea>
</template>

<script>
export default {
data(){
return{
msg:'World',
htmlStr: '<p style="color: red;">Hello</p>',
vmodel:'Nice',
message:'여러라인의 값을 입력하ㅔㅅ요,'
}
}
}
</script>
32 changes: 32 additions & 0 deletions src/views/DataBinding2.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<select v-model="city">
<option value="02">서울</option>
<option value="03">부산</option>
<option value="04">제주</option>
</select>
<p>{{ city }}</p>
<label>선택: <input type="checkbox" true-value="yes" false-value="no" v-model="checked"></label>
<p>선택값:{{ checked }}</p>

<!-- v-model 속성 체크되면 value값 반환?? -->
<label><input type="checkbox" v-model="checkItems" value="01">서울</label>
<label><input type="checkbox" v-model="checkItems" value="02">부산</label>
<label><input type="checkbox" v-model="checkItems" value="03">제주</label>
<label><input type="checkbox" v-model="checkItems" value="04">대전</label>
<p>선택값: {{ orderItems }}</p>
</template>

<script>
export default {
data() {
return {
city: "04",
checked: "yes",
// 배열로 선언 => value 값 담을 수 있음
// 배열 없이 변수로 선언시 T/F 만 가능
checkItems: ["01"]
}
}
}
</script>
28 changes: 28 additions & 0 deletions src/views/DataBinding3.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<label>선택: <input type="checkbox" true-value="yes" false-value="no" v-model="checked"></label>
<p>선택값: {{ checked }}</p>

<label>text속성: <input type="text" v-bind:value="ival"></label>
<p>값: {{ ival }}</p>

<!-- v-bind: attribute의 값을 바인딩 -->
<img v-bind:src="imgSrc" v-bind:width="imgWidth">
<input type="text" v-model="textStr">
<button v-bind:disabled="textStr == ''">Click</button>
</template>

<script>
export default {
data() {
return {
checked: "yes",
ival: "sample",
checkVal: true,
imgSrc: 'https://kr.vuejs.org/images/logo.png',
imgWidth: "100px",
isTrue: true,
textStr: ''
}
}
}
</script>
59 changes: 59 additions & 0 deletions src/views/DataBinding4.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<template>
<div class="container" v-bind:class="simpleClass">
Hello
</div>
<div class="container" v-bind:class="{ active: activeValue, 'text-red': redValue }">
Hello
</div>
<div class="container" v-bind:class="{ active: activeClass, 'text-red': redClass }">
Hello
</div>
<div style="color: red; background: yellow;">sty1</div>
<div v-bind:style="{ color: att1, background: att2 }">
sty2
</div>
<div v-bind:style="colorStyle">sty3</div>
</template>

<script>
export default {
data() {
return {
simpleClass: 'active text-red',
activeValue: true,
redValue: false,
activeClass: 'active',
redClass: 'text-red',
att1: 'red',
att2: 'yellow',
//colorStyle: 'color: red; background: yellow;'
colorStyle :{
color:'red',
background:'yellow'
}
};
},
//mount는 data 영역 끝나고 선언 해야 함.
mount(){
console.log(this);
},
method:{
//이벤트 실행함수
}
};
</script>

<style>
.container{
width : 100%;
height : 50px;
}
.active{
background-color: yellow;
font-weight: bold;
}
.text-red{
color:red;
}
</style>
Loading

0 comments on commit 0574ad0

Please sign in to comment.