ComponentPanel.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { useResource } from "@/modules/resource";
  2. import { Image, List } from "@queenjs/ui";
  3. import { Button } from "ant-design-vue";
  4. import { defineComponent } from "vue";
  5. import { any } from "vue-types";
  6. export default defineComponent({
  7. setup() {
  8. const resource = useResource();
  9. return () => {
  10. const list = resource.store.sourceDetail.webEditor?.matSlots || [];
  11. return (
  12. <div class="w-300px flex flex-col">
  13. <div class="p-15px text-16px text-white border-dark-800 border-0 border-b-1 border-solid">
  14. 组件列表
  15. </div>
  16. <List data={list} gap="10px" class="scrollbar flex-1 py-15px px-15px">
  17. {{
  18. item: (record: any) => <CompItem record={record} />,
  19. loadmore: () => (
  20. <div class="text-center py-20px text-12px opacity-80">
  21. 没有更多了
  22. </div>
  23. ),
  24. }}
  25. </List>
  26. </div>
  27. );
  28. };
  29. },
  30. });
  31. const CompItem = defineComponent({
  32. props: {
  33. record: any().isRequired,
  34. },
  35. setup(props) {
  36. return () => {
  37. const { record } = props;
  38. return (
  39. <div
  40. class="flex items-center py-6px px-12px rounded-4px"
  41. style={{ backgroundColor: "#303030" }}
  42. >
  43. <Image src={record.thumbnail} class="w-48px rounded-4px" />
  44. <div class="ml-10px flex-1 mr-5px w-0">{record.name || "未命名"}</div>
  45. <Button type="primary" ghost size="small">
  46. 替换
  47. </Button>
  48. </div>
  49. );
  50. };
  51. },
  52. });