Skip to content

Instantly share code, notes, and snippets.

@boonyasukd
Created July 17, 2017 11:21
Show Gist options
  • Save boonyasukd/759fbfa758c6ab2da1fa5ef1db7b54ca to your computer and use it in GitHub Desktop.
Save boonyasukd/759fbfa758c6ab2da1fa5ef1db7b54ca to your computer and use it in GitHub Desktop.
<template>
<div class="container">
<div class="row">
<div class="col-xs-12">
<br>
<button class="btn btn-primary" @click="selected = 'app-blue'">Load Blue Template</button>
<button class="btn btn-success" @click="selected = 'app-green'">Load Green Template</button>
<button class="btn btn-danger" @click="selected = 'app-red'">Load Red Template</button>
<hr>
<component :is="selected">
<span>Hey yo!</span>
</component>
</div>
</div>
</div>
</template>
<script>
import Blue from './components/Blue.vue';
import Green from './components/Green.vue';
import Red from './components/Red.vue';
export default {
data() {
return {
selected: null,
};
},
components: {
appBlue: Blue,
appGreen: Green,
appRed: Red
}
}
</script>
<template>
<div>
<slot></slot>
</div>
</template>
<script>
</script>
<style scoped>
div {
border: 1px solid blue;
background-color: lightblue;
padding: 30px;
margin: 20px auto;
text-align: center
}
</style>
<template>
<div>
<slot></slot>
</div>
</template>
<script>
</script>
<style scoped>
div {
border: 1px solid green;
background-color: lightgreen;
padding: 30px;
margin: 20px auto;
text-align: center
}
</style>
<template>
<div>
<slot></slot>
</div>
</template>
<script>
</script>
<style scoped>
div {
border: 1px solid red;
background-color: lightcoral;
padding: 30px;
margin: 20px auto;
text-align: center
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment