Created
November 24, 2016 00:55
-
-
Save jason/2235d473b9ee715c8daa7fdb4a9e8eef to your computer and use it in GitHub Desktop.
This file contains 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
<template> | |
<div> | |
<span class="Plan__name">{{ plan.name }}</span> | |
<span class=Plan__price>{{ plan.price}}/month</span> | |
<button @click=setActivePlan>Upgrade</button> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: 'plan', | |
methods: { | |
setActivePlan: function () { | |
this.active = this.plan | |
} | |
}, | |
props: ['plan', 'active'] | |
} | |
</script> | |
<!-- Add "scoped" attribute to limit CSS to this component only --> | |
<style scoped> | |
h1, h2 { | |
font-weight: normal; | |
} | |
ul { | |
list-style-type: none; | |
padding: 0; | |
} | |
li { | |
display: inline-block; | |
margin: 0 10px; | |
} | |
a { | |
color: #42b983; | |
} | |
.Plan__name { | |
display: inline-block; min-width: 8rem; text-align: left;} | |
.Plan__price {display: inline-block; min-width: 8rem; text-align: left;} | |
</style> |
This file contains 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
<template> | |
<div> | |
<pre> | |
{{ $data | json }} | |
</pre> | |
<div v-for="plan in plans"> | |
<plan :plan="plan" :active.sync="active"></plan> | |
</div> | |
</div> | |
</template> | |
<script> | |
import Plan from './Plan' | |
export default { | |
name: 'plans', | |
data () { | |
return { | |
plans: [ | |
{ name: 'Enterprise', price: 100 }, | |
{ name: 'Pro', price: 50 }, | |
{ name: 'Personal', price: 10 }, | |
{ name: 'Free', price: 0 } | |
], | |
active: {} | |
} | |
}, | |
components: { | |
Plan | |
} | |
} | |
</script> | |
<!-- Add "scoped" attribute to limit CSS to this component only --> | |
<style scoped> | |
h1, h2 { | |
font-weight: normal; | |
} | |
ul { | |
list-style-type: none; | |
padding: 0; | |
} | |
li { | |
display: inline-block; | |
margin: 0 10px; | |
} | |
a { | |
color: #42b983; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment