DialogLayout.vue 3.27 KB
Newer Older
hucy's avatar
hucy committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
<script setup lang="ts">
import { reactive, computed } from 'vue';

interface IDetailProps {
  title?: any;
  width?: number;
  maxWidth?: number;
  minWidth?: number;
  height?: number;
  maxHeight?: number;
  minHeight?: number;
}
const props = withDefaults(defineProps<IDetailProps>(), {
  title: '',
  width: 1000,
  maxWidth: 1000,
  minWidth: 500,
  height: 600,
  maxHeight: 900,
  minHeight: 500,
});

const emit = defineEmits<{
  (e: 'onOk'): void;
  (e: 'onCancel'): void;
}>();

const myCardStyle = computed(() => {
  return {
    width: props.width + 'px',
    maxWidth: props.maxWidth + 'px',
    minWidth: props.minWidth + 'px',
    height: props.height + 'px',
    maxHeight: props.maxHeight + 'px',
    minHeight: props.minHeight + 'px',
  };
});

const thumbStyle = reactive({
  right: '4px',
  borderRadius: '5px',
  backgroundColor: '#64b3f4',
  width: '5px',
  opacity: '1',
});

const barStyle = reactive({
  right: '2px',
  borderRadius: '9px',
  backgroundColor: '#027be3',
  width: '9px',
  opacity: '0.2',
});

function onCancel() {
  emit('onCancel');
}
function onSave() {
  emit('onOk');
}
</script>
<template>
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
  <q-card class="box" :style="myCardStyle">
    <div class="main" :style="myCardStyle">
      <div class="card-content">
        <div class="title"></div>
        <div class="content">
          <q-scroll-area
            style="height: 100%; max-width: 100%"
            :thumb-style="thumbStyle"
            :bar-style="barStyle"
          >
            <slot></slot>
          </q-scroll-area>
        </div>
        <div class="bottom-action">
          <q-btn flat style="color: #64b3f4" label="取消" @click="onCancel" />
          <q-btn
            unelevated
            style="background: #64b3f4; color: white"
            label="确定"
            @click="onSave()"
          />
        </div>
hucy's avatar
hucy committed
85 86
      </div>
    </div>
87 88 89
    <div class="title-mask">
      <span>{{ title }}</span>
    </div>
hucy's avatar
hucy committed
90 91 92 93
  </q-card>
</template>

<style lang="scss" scoped>
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
.box {
  position: relative;
}
.title-mask {
  box-sizing: border-box;
  position: absolute;
  top: 29.5px;
  height: 30.5px;
  border-radius: 0 !important;
  border-top-right-radius: 15px !important;
  border-bottom-right-radius: 15px !important;
  background-color: #64b3f4;
  padding-left: 20px;
  display: flex;
  align-items: center;
  box-shadow: rgba(0, 0, 0, 0.07) 0px 1px 1px, rgba(0, 0, 0, 0.07) 0px 2px 2px,
    rgba(0, 0, 0, 0.07) 0px 4px 4px, rgba(0, 0, 0, 0.07) 0px 8px 8px,
    rgba(0, 0, 0, 0.07) 0px 16px 16px;

  > span {
    color: white;
    font-size: 15px;
    font-weight: bold;
    padding-left: 8px;
    padding-right: 17px;
  }
}
.main {
  position: relative;
hucy's avatar
hucy committed
123 124 125 126 127
  padding: 20px;
  background-image: linear-gradient(60deg, #c2e59c 0%, #64b3f4 100%);
  box-sizing: border-box;
  display: flex;
}
128

hucy's avatar
hucy committed
129 130 131 132 133 134 135 136 137 138
.card-content {
  width: 100%;
  background-color: #fff;

  display: flex;
  flex-direction: column;

  overflow: hidden;

  .title {
139
    box-sizing: border-box;
hucy's avatar
hucy committed
140 141 142
    height: 40px;
    font-weight: bolder;
    display: flex;
143 144
    align-items: flex-end;
    // border: 1px solid red;
hucy's avatar
hucy committed
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
  }
  .content {
    flex: 1;
    padding: 8px;
    position: relative;
  }
  .bottom-action {
    padding: 8px;

    display: flex;
    flex-direction: row;
    column-gap: 4px;
    justify-content: flex-end;
    align-items: center;
  }
}
</style>