dropdown-menu.vue 482 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <div class="dropdown-menu">
  3. <slot></slot>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. }
  11. },
  12. mounted() {
  13. this.$on('close', this.closeDropdown)
  14. },
  15. methods: {
  16. closeDropdown() {
  17. this.$children.forEach(item =>{
  18. item.close();
  19. })
  20. }
  21. }
  22. }
  23. </script>
  24. <style lang="scss">
  25. .dropdown-menu {
  26. display: flex;
  27. overflow: auto;
  28. white-space: nowrap;
  29. }
  30. dropdown-item {
  31. flex: 1;
  32. }
  33. </style>