본문 바로가기
반응형

분류 전체보기574

[k8s] hostAliases 에 여러 개 등록하기 apiVersion: v1 kind: Pod metadata: name: hostaliases-pod spec: restartPolicy: Never hostAliases: - ip: "127.0.0.1" hostnames: - "hello.com" - "bryan.com" - ip: "10.1.2.3" hostnames: - "tistory.com" - "naver.com" containers: - name: cat-hosts image: busybox command: - cat args: - "/etc/hosts" 이 pod 에서 hello.com 또는 bryan.com 을 호출하면 127.0.0.1 로 간다는 뜻입니다. 그 아래도 마찬가지로 tistory.com 또는 naver.com 을 호출하면 .. 2021. 1. 15.
[Vue] jQuery 사용하기 #eslint 설정 Vue jQuery 사용하기 jQuery 설치 npm install --save jquery Tip main.js 에서 window.$ = require('jquery') 이렇게 선언하면 window.$('#id') 와 같이 사용할 수 있지만 window.$ 대신 $ 만 쓰고 싶다면 아래와 같이 webpack 에 설정해야하고, eslint 를 사용하고 있다면 여기에도 설정을 해야합니다. Webpack.config.js 에 설정 module.exports = { ... plugins: [ new webpack.ProvidePlugin({ $: 'jquery', jquery: 'jquery', 'window.jQuery': 'jquery', jQuery: 'jquery' }) ] ... } eslint 를 .. 2021. 1. 15.
[Nodejs] session 사용하기 nodejs session session 에 값 설정하기 router.get('/login', (req, res) => { // 인증로직 성공 했다 치고 req.session.user = body req.session.user.expire = new Date() }) session 값 삭제하기 router.get('/logout', (req, res) => { req.session.destroy(function () { req.session }) }) 2021. 1. 15.
[Vue] 화살표함수 (arrow funcion) 사용 시 주의사항 #삽질주의 arrow function 사용 주의 사항 () => {} 결론부터 created: () => console.log(this.a) // 오류. 여기서 this 는 vue instance 가 아닌 window // mounted, udpated, destroyed 마찬가지. methods: { methodA: () => { // arrow function 사용하면 안됨 // this 는 window alert(this == window) // true this.methodB() // 오류 }, methodB: function(){ // this 는 현재 vue instance this.methodA() // 정상 }, methodC() { this.methodA() // 정상 } } 왜? Each Vue .. 2021. 1. 14.
[Vue] Vuetify v-treeview select #programmatically v-treeview select from method 코드로 이해하기. template select all select some unselect js new Vue({ el: '#app', vuetify: new Vuetify(), data(){ return { selectionType: 'leaf', selection: [], items: [ { id: 1, name: 'Root', children: [ { id: 2, name: 'Child #1' }, { id: 3, name: 'Child #2' }, { id: 4, name: 'Child #3', children: [ { id: 5, name: 'Grandchild #1' }, { id: 6, name: 'Grandchild #2' }, ], }.. 2021. 1. 14.
[Vue] vuex actions 에서 다른 action 호출하기 actions 에서 다른 action 호출하기 아래와 같은 소스가 있을 때 method_A 에서 method_B를 호출하는 방법은, const state = { something: '' } const mutations = { setSomething (state, message) { state.something = message } } const actions = { method_A({ commit }) { // method_B 호출 commit('setSomething', 'from method A') }, method_B({ commit }) { // .. do something } } 1. method_A 에 파라메터에 dispatch 추가 2. dispatch 를 이용하여 method_B 호출 me.. 2021. 1. 13.
[Vue] vuex actions 에서 mutation, state 사용하기 actions 에서 mutations 호출하기 예제 소스 코드 const state = { something: '' } const mutations = { setSomething (state, message) { state.something = message } } const actions = { method_A({ commit }) { commit('setSomething', 'from method A') } } actions 의 method_A 라는 메소드에 첫번 째 파라메터를 보면 { } 사이에 commit 을 받고 있습니다. 이걸 이용해서 mutations 을 호출합니다. commit('setSomething', 'from method A') --> setSomething(state, messag.. 2021. 1. 13.
[Vue] router 에서 여러가지 주소 사용하기 #alias search 와 find의 router의 components 가 같습니다. { path: '/search/:text', components: { header: Header, default: MainBody, footer: Footer } }, { path: '/find/:text', components: { header: Header, default: MainBody, footer: Footer } } 두개의 URL을 사용하고, 같은 동작을 해야 한다면 아래의 방법이 관리하기가 더 쉽습니다. { path: '/search/:text', alias: ['/find/:text'], components: { header: Header, default: MainBody, footer: Footer } } ali.. 2021. 1. 12.
[Vue] store. action 에서 다른 action 호출하기 actions 안에 methodA 에서 methodB를 호출하려고 할 때, 인자로 dispatch를 받은 후 dispatch를 이용해서 다른 메소드를 호출하면 됩니다. const actions = { methodA ({ commit, dispatch }) { dispatch('methodB') }, methodB ({ commit }) { } } 2021. 1. 12.
[Bootstrap4] col-xs-* not working bootstrap 4 부터는 col-xs-12 이렇게 쓰던것을 col-12 로 사용하면 됩니다. grid 관련 공식 문서 xs-hidden 도 drop 됐습니다. 4 부터는 아래와 같이 사용합니다. 공식 문서 참고 html tag 의 class 에서 사용할 땐 . 빼야 되는거 아시쥬? 2021. 1. 11.
728x90
반응형