index.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <view class="nut-notify">
  3. <nut-popup
  4. v-model="curVisible"
  5. position="top"
  6. :style="{ color: color, background: background }"
  7. :overlay="false"
  8. :lockScroll="false"
  9. :class="['nut-notify', `nut-notify--${type}`, { className }]"
  10. @click="handleClick"
  11. @opened="handleOpened"
  12. @closed="handleClosed"
  13. >
  14. <template v-if="$slots.default">
  15. <slot></slot>
  16. </template>
  17. <template v-else>{{ msg }}</template>
  18. </nut-popup>
  19. </view>
  20. </template>
  21. <script lang="ts">
  22. import { toRefs } from 'vue';
  23. import { createComponent } from '@/utils/create';
  24. import Popup from '@/packages/popup/index.vue';
  25. const { componentName, create } = createComponent('notify');
  26. export default create({
  27. props: {
  28. color: String,
  29. message: [Number, String],
  30. className: null,
  31. background: String,
  32. type: {
  33. type: String,
  34. default: 'danger'
  35. }
  36. },
  37. setup(props, { slots }) {
  38. return {};
  39. }
  40. });
  41. </script>
  42. <style lang="scss">
  43. @import 'index.scss';
  44. </style>