detail-frame.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div id="detail-frame" :style="`height:${heights}px;overflow:auto`">
  3. <!-- <el-scrollbar style="height:100%"> -->
  4. <el-card style="background-image: linear-gradient(315deg, #CCF, transparent);border-radius: 60px;" shadow="hover">
  5. <el-row>
  6. <el-col :span="24" class="title">
  7. <span v-if="returns">
  8. <el-button size="mini" plan circle @click="toReturn" style="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)">
  9. <span class="el-icon-arrow-left" style="zoom:1.5;font-weight:700"></span>
  10. </el-button>
  11. </span>
  12. <slot name="title">
  13. {{ title }}
  14. </slot>
  15. </el-col>
  16. </el-row>
  17. <div style="padding:1.25rem;overflow: inherit;overflow-x: auto;">
  18. <!-- <el-scrollbar style="height:100%"> -->
  19. <slot></slot>
  20. <!-- </el-scrollbar> -->
  21. </div>
  22. </el-card>
  23. <!-- </el-scrollbar> -->
  24. </div>
  25. </template>
  26. <script>
  27. import _ from 'lodash';
  28. export default {
  29. name: 'detail-frame',
  30. props: {
  31. title: { type: String },
  32. returns: { type: null, default: null },
  33. },
  34. components: {},
  35. data: () => ({
  36. heights: document.documentElement.clientHeight - 80,
  37. }),
  38. created() {},
  39. mounted() {
  40. const that = this;
  41. window.onresize = () => {
  42. return (() => {
  43. window.fullHeight = document.documentElement.clientHeight - 80;
  44. that.heights = window.fullHeight;
  45. })();
  46. };
  47. },
  48. computed: {},
  49. methods: {
  50. toReturn() {
  51. if (_.isString(this.returns)) this.$router.push({ path: this.returns });
  52. else if (_.isFunction(this.returns)) {
  53. let fun = _.get(this, `returns`);
  54. fun();
  55. }
  56. },
  57. },
  58. };
  59. </script>
  60. <style lang="less" scoped>
  61. .title {
  62. font-size: 1rem;
  63. font-weight: 700;
  64. padding: 0.8rem;
  65. }
  66. /deep/.el-scrollbar__wrap {
  67. overflow-x: auto;
  68. }
  69. /deep/.el-card__body {
  70. overflow: inherit;
  71. }
  72. </style>