我想创建一个按钮,单击后将更改 md-card 的颜色。我不确定我应该怎么做。我知道这里应该是变量,点击后从 false 变为 true,然后执行一些函数,但不知道里面应该是什么。
<template>
<div>
<md-card class="md-primary" md-with-hover >
<md-ripple>
<md-card-header>
<div class="md-title" >color</div>
</md-card-header>
<md-card-actions md-alignment="space-between">
<md-button v-on:click="available = !available">Action</md-button>
</md-card-actions>
</md-ripple>
</md-card>
</div>
</template>
<script>
export default {
name: 'FirstRouteChild',
data: {
available: true,
},
computed: {
}
}
</script>
<style lang="scss" scoped>
@import "../../node_modules/vue-material/src/theme/engine";
@import "../../node_modules/vue-material/src/base/theme";*/
@import "../../node_modules/vue-material/src/components/MdCard/theme";
@include md-register-theme("default", (
primary: md-get-palette-color(green, A200), // The primary color of your application
accent: md-get-palette-color(red, A200) // The accent or secondary color
));
.md-card {
width: 320px;
margin: 4px;
display: inline-block;
vertical-align: top;
}
</style>