项目原始demo,不改动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

84 line
1.9 KiB

  1. // Styles
  2. import "../../../src/components/VCard/VCard.sass"; // Extensions
  3. import VSheet from '../VSheet'; // Mixins
  4. import Loadable from '../../mixins/loadable';
  5. import Routable from '../../mixins/routable'; // Helpers
  6. import mixins from '../../util/mixins';
  7. /* @vue/component */
  8. export default mixins(Loadable, Routable, VSheet).extend({
  9. name: 'v-card',
  10. props: {
  11. flat: Boolean,
  12. hover: Boolean,
  13. img: String,
  14. link: Boolean,
  15. loaderHeight: {
  16. type: [Number, String],
  17. default: 4
  18. },
  19. outlined: Boolean,
  20. raised: Boolean,
  21. shaped: Boolean
  22. },
  23. computed: {
  24. classes() {
  25. return {
  26. 'v-card': true,
  27. ...Routable.options.computed.classes.call(this),
  28. 'v-card--flat': this.flat,
  29. 'v-card--hover': this.hover,
  30. 'v-card--link': this.isClickable,
  31. 'v-card--loading': this.loading,
  32. 'v-card--disabled': this.disabled,
  33. 'v-card--outlined': this.outlined,
  34. 'v-card--raised': this.raised,
  35. 'v-card--shaped': this.shaped,
  36. ...VSheet.options.computed.classes.call(this)
  37. };
  38. },
  39. styles() {
  40. const style = { ...VSheet.options.computed.styles.call(this)
  41. };
  42. if (this.img) {
  43. style.background = `url("${this.img}") center center / cover no-repeat`;
  44. }
  45. return style;
  46. }
  47. },
  48. methods: {
  49. genProgress() {
  50. const render = Loadable.options.methods.genProgress.call(this);
  51. if (!render) return null;
  52. return this.$createElement('div', {
  53. staticClass: 'v-card__progress',
  54. key: 'progress'
  55. }, [render]);
  56. }
  57. },
  58. render(h) {
  59. const {
  60. tag,
  61. data
  62. } = this.generateRouteLink();
  63. data.style = this.styles;
  64. if (this.isClickable) {
  65. data.attrs = data.attrs || {};
  66. data.attrs.tabindex = 0;
  67. }
  68. return h(tag, this.setBackgroundColor(this.color, data), [this.genProgress(), this.$slots.default]);
  69. }
  70. });
  71. //# sourceMappingURL=VCard.js.map