index.vue 804 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <view :class="classes" @click="handleClick">
  3. <view>{{ name }}</view>
  4. <view>{{ txt }}</view>
  5. </view>
  6. </template>
  7. <script lang="ts">
  8. import { toRefs } from 'vue';
  9. import { createComponent } from '@/utils/create';
  10. const { componentName, create } = createComponent('infiniteloading');
  11. export default create({
  12. props: {
  13. name: {
  14. type: String,
  15. default: ''
  16. },
  17. txt: {
  18. type: String,
  19. default: ''
  20. }
  21. },
  22. components: {},
  23. emits: ['click'],
  24. setup(props, { emit }) {
  25. console.log('componentName', componentName);
  26. const { name, txt } = toRefs(props);
  27. const handleClick = (event: Event) => {
  28. emit('click', event);
  29. };
  30. return { name, txt, handleClick };
  31. }
  32. });
  33. </script>
  34. <style lang="scss">
  35. @import 'index.scss';
  36. </style>