m-checkbox-group.vue 674 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <view class="checkboxGroup">
  3. <view @tap.native="changeCheckboxGroup">
  4. <slot></slot>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {};
  12. },
  13. methods: {
  14. changeCheckboxGroup(e) {
  15. console.log(e);
  16. e.detail = e.target.dataset.item;
  17. this.$emit("update:value", e.target.dataset.value);
  18. this.$emit("change", e);
  19. },
  20. },
  21. props: {
  22. useIconSlot: {
  23. type: Boolean,
  24. default: false,
  25. },
  26. name: {
  27. type: String,
  28. default: "",
  29. },
  30. value: {
  31. type: String,
  32. default: "",
  33. },
  34. },
  35. };
  36. </script>
  37. <style lang="scss" scoped>
  38. .checkboxGroup {
  39. }
  40. </style>