Created
June 11, 2018 09:15
-
-
Save Yang03/158de433b6322d81945ccc66267e7310 to your computer and use it in GitHub Desktop.
vue test
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
``` | |
const test = Vue.component('test', { | |
props: ['msg'], | |
template:'<div><p>{{msg}}</p><slot name="action">xx</slot></div>' | |
}) | |
new Vue({ | |
el: '#app', | |
data: { | |
message: 'Hello Vue.js!' | |
}, | |
components: {'test': test} | |
}) | |
``` | |
``` | |
<script src="https://unpkg.com/vue"></script> | |
<div id="app"> | |
<!-- <p>{{ message }}</p> --> | |
<!-- <p slot="action"> | |
slot | |
</p> --> | |
<test :msg="message"> | |
<div class="action" slot="action"> | |
test | |
</div> | |
</test> | |
</div> | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment