This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm i --save-dev expose-loader | |
npm i --save jquery |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var EventBus = Vue(); | |
Object.defineProperties(Vue.prototype, { | |
$eventBus: { | |
get: function () { | |
return EventBus; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var EventBus = new Vue(); | |
var SenderApp = new Vue({ | |
el: '#sender-app', | |
data() { | |
return { | |
text: '', | |
receiveText: '' | |
} | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="sender-app"> | |
<input v-model="text"> | |
<button @click="sender">sender</button> | |
<div v-if="receiveText">#sender-app: I sent a message a {{ receiveText }}</div> | |
</div> | |
<div id="receiver-app"> | |
<div v-if="text">#receiver-app: {{ text }}</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ์ด๋ฒคํธ ๊ตฌ๋ | |
EventBus.$on('message', function(text) { | |
console.log(text); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ์ด๋ฒคํธ ๋ฐํ | |
EventBus.$emit('message', 'hello world'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ์ด๋ฒคํธ๋ฒ์ค ์์ฑ | |
var EventBus = new Vue() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
created: function() { | |
// ... | |
this.$nextTick(function() { | |
var dom = document.getElementById('item-0'); | |
dom.style.backgroundColor = 'red'; | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- ์ค๋ฅ ์์ --> | |
<div id="app"> | |
<div v-for="item in list"> | |
<div v-bind:id="bindId(item)">{{item}}</div> <!-- 2 --> | |
</div> | |
</div> | |
<script> | |
new Vue({ | |
el: '#app', |