vuetify
Version:
Vue.js 2 Semantic Component Framework
68 lines (57 loc) • 1.57 kB
JavaScript
require('../../../src/stylus/components/_cards.styl');
import Colorable from '../../mixins/colorable';
import Routable from '../../mixins/routable';
import Themeable from '../../mixins/themeable';
export default {
name: 'v-card',
mixins: [Colorable, Routable, Themeable],
props: {
flat: Boolean,
height: {
type: String,
default: 'auto'
},
hover: Boolean,
img: String,
raised: Boolean,
tag: {
type: String,
default: 'div'
},
tile: Boolean,
width: [String, Number]
},
computed: {
classes: function classes() {
return this.addBackgroundColorClassChecks({
'card': true,
'card--flat': this.flat,
'card--horizontal': this.horizontal,
'card--hover': this.hover,
'card--raised': this.raised,
'card--tile': this.tile,
'theme--light': this.light,
'theme--dark': this.dark
});
},
styles: function styles() {
var style = {
height: isNaN(this.height) ? this.height : this.height + 'px'
};
if (this.img) {
style.background = 'url("' + this.img + '") center center / cover no-repeat';
}
if (this.width) {
style.width = isNaN(this.width) ? this.width : this.width + 'px';
}
return style;
}
},
render: function render(h) {
var _generateRouteLink = this.generateRouteLink(),
tag = _generateRouteLink.tag,
data = _generateRouteLink.data;
data.style = this.styles;
return h(tag, data, this.$slots.default);
}
};