반응형

JS/Vue 6

Vue.js 디렉티브 directive (v-on, v-bind)

디렉티브 : vue 엘리먼트의 데이터, 함수 또는 event를 html tag와 연결 v-on 엘리먼트에 이벤트 리스너를 연결 DOM에 이벤트가 발생했을때 javascript를 실행 약어 : "v-on" ->> "@" html Hello Hello Hello javascript new Vue({ el: '#app', methods: { hello: function(){ alert('hello'); }, helloMsg: function(msg, e){ e.stopPropagation(); alert('hello' + ' ' + msg); } } }); v-bind html tag의 속성과 vue 데이터를 연결 약어 : "v-bind" ->> ":" html hello javascript new Vue({..

JS/Vue 2021.02.12

Vue.js 디렉티브 directive (v-text, v-html, v-show, v-if)

디렉티브 : vue 엘리먼트의 데이터, 함수 또는 event를 html tag와 연결 v-text 콧수염괄호와 동일 {{ message }} html {{message}} javascript new Vue({ el: '#app', data: { message: 'hello' } }); v-html Vue의 데이터를 html로 삽입 html javascript new Vue({ el: '#app', data: { message: 'hello Vue' } }); v-show css display 속성의 "block"/"none" 또는 jquery의 show()/hide() html show hide javascript new Vue({ el: '#app', data: { show: true, hide: fa..

JS/Vue 2021.02.11

Vue.js 라우터

router-view 사용자가 url을 직접 입력하여 해당하는 url로 이동 html javascript var router = new VueRouter({ routes: [ { path: '/foo', component: { template: 'foo' } }, { path: '/bar', component: { template: 'bar' } } ] }); new Vue({ el: '#app', router: router }); view-link url 입력없이 링크를 클릭하여 해당하는 url로 이동 html foo bar javascript var router = new VueRouter({ routes: [ { path: '/foo', component: { template: 'foo' } }, ..

JS/Vue 2021.02.08
반응형