s9e125 switching multiple components with dynamic components
This commit is contained in:
parent
83ba9f9a29
commit
24a5ed444e
@ -2,10 +2,18 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<app-quote>
|
<button @click="selectedComponent = 'appQuote'">Quote</button>
|
||||||
|
<button @click="selectedComponent = 'appAuthor'">Author</button>
|
||||||
|
<button @click="selectedComponent = 'appNew'">New</button>
|
||||||
|
<hr>
|
||||||
|
<!--<app-quote>-->
|
||||||
|
|
||||||
|
<!--</app-quote>-->
|
||||||
|
<component :is="selectedComponent"
|
||||||
|
>
|
||||||
<h2 slot="title">{{quoteTitle}}</h2>
|
<h2 slot="title">{{quoteTitle}}</h2>
|
||||||
<p>A Simple Quote</p>
|
<p>A Simple Quote</p>
|
||||||
</app-quote>
|
</component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -13,15 +21,20 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Quote from './components/Quote.vue'
|
import Quote from './components/Quote.vue'
|
||||||
|
import Author from './components/Author.vue'
|
||||||
|
import New from './components/New.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
quoteTitle: "The Quote"
|
quoteTitle: "The Quote",
|
||||||
|
selectedComponent: 'appQuote'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
appQuote: Quote
|
appQuote: Quote,
|
||||||
|
appAuthor: Author,
|
||||||
|
appNew: New,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user