VciNotification.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div
  3. :style="syl"
  4. class="VciNotification vci-fs-16"
  5. >
  6. <div class="vn-head vci-flex-rmb">
  7. <strong class="vn-title">{{ title }}</strong>
  8. <VciClose @pointerup="$emit('close')" />
  9. </div>
  10. <div class="vn-body">
  11. <p>{{ message }}</p>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. // power by visual-ceiling, at 2023/7/17 15:56
  17. import VciClose from "../VciClose.vue";
  18. import { hexToRgba, rgbaToHex } from "@vci/helper/src/color";
  19. export default {
  20. name: "VciNotification",
  21. components: { VciClose },
  22. props: {
  23. title: {
  24. type: String,
  25. default: "提示"
  26. },
  27. message: {
  28. type: String,
  29. default: "来自勤奋的vci"
  30. },
  31. theme: {
  32. type: String,
  33. default: "#000"
  34. }
  35. },
  36. data() {
  37. return {};
  38. },
  39. computed: {
  40. syl() {
  41. const theme = /^rgba\(/.test(this.theme) ? rgbaToHex(this.theme) : this.theme;
  42. return {
  43. borderColor: hexToRgba(theme, .8),
  44. backgroundColor: hexToRgba(theme, .6),
  45. boxShadow: `0 0 8px ${hexToRgba(theme, .6)}, 0 0 16px ${hexToRgba(theme, .2)})`
  46. };
  47. }
  48. }
  49. };
  50. </script>
  51. <style lang="scss" scoped>
  52. .VciNotification {
  53. width: 320px;
  54. padding: 10px 12px;
  55. border: 1px solid rgba(#000, .6);
  56. border-radius: 4px;
  57. background-color: rgba(#000, .4);
  58. backdrop-filter: blur(4px);
  59. box-shadow: 0 0 8px rgba(#000, .6), 0 0 16px rgba(#000, .2);
  60. .vn-head {
  61. align-items: flex-start;
  62. .VciClose {
  63. flex-shrink: 0;
  64. margin-left: 4px;
  65. }
  66. }
  67. .vn-body {
  68. padding-top: 12px;
  69. word-break: break-all;
  70. }
  71. }
  72. </style>