From 7764fcafc9b8fdf20b33c49e3be59943c7b78b92 Mon Sep 17 00:00:00 2001
From: bqy_fe <1743369777@qq.com>
Date: Mon, 12 Jul 2021 10:26:03 +0800
Subject: [PATCH] feat(components): :sparkles:add tabbar component
---
 README.EN.md                                  |  18 +-
 README.md                                     |   2 -
 package.json                                  |   8 +-
 preview/views/preview.vue                     |  10 +-
 .../base-widgets/datetimePicker/index.tsx     |   4 +-
 src/packages/base-widgets/nav-bar/index.tsx   |  40 ++-
 src/packages/base-widgets/picker/index.tsx    |   6 +-
 src/packages/base-widgets/swipe/index.tsx     |   7 +-
 src/packages/base-widgets/tabbar/index.tsx    | 116 +++++++++
 .../base-widgets/tabbar/tabbar-item.tsx       |  47 ++++
 .../container-component/form/index.tsx        |   6 +-
 .../container-component/layout/index.tsx      |   6 +-
 src/shims-vue.d.ts                            |  32 ---
 .../components/header/preview.vue             |   4 +-
 .../components/base-widgets/index.module.scss |   1 +
 .../components/base-widgets/index.tsx         |   3 +-
 .../container-component/index.module.scss     |  32 +--
 .../components/container-component/index.tsx  |   3 +-
 .../components/data-source/data-fetch.vue     |   6 +-
 .../components/attr-editor/AttrEditor.tsx     | 238 ------------------
 .../cross-sortable-options-editor.tsx         | 172 ++++++++-----
 .../components/prop-config/index.tsx          | 134 ++++++++++
 .../components/attr-editor/index.tsx          | 138 ++++++++++
 .../components/event-action/index.tsx         |  16 +-
 .../components/form-rule/index.tsx            |  37 ++-
 .../right-attribute-panel/components/index.ts |   4 +-
 .../draggable-transition-group.vue            |   5 +-
 .../simulator-editor/simulator-editor.vue     |  34 ++-
 .../components/simulator-editor/slot-item.vue |  33 ++-
 src/visual-editor/types/index.d.ts            |  34 ++-
 src/visual-editor/visual-editor.props.tsx     |  26 +-
 src/visual-editor/visual-editor.utils.ts      |  35 ++-
 vite.config.ts                                |   2 +-
 yarn.lock                                     |  31 ++-
 34 files changed, 822 insertions(+), 468 deletions(-)
 create mode 100644 src/packages/base-widgets/tabbar/index.tsx
 create mode 100644 src/packages/base-widgets/tabbar/tabbar-item.tsx
 delete mode 100644 src/shims-vue.d.ts
 delete mode 100644 src/visual-editor/components/right-attribute-panel/components/attr-editor/AttrEditor.tsx
 create mode 100644 src/visual-editor/components/right-attribute-panel/components/attr-editor/components/prop-config/index.tsx
 create mode 100644 src/visual-editor/components/right-attribute-panel/components/attr-editor/index.tsx
diff --git a/README.EN.md b/README.EN.md
index 93ee768..3028721 100644
--- a/README.EN.md
+++ b/README.EN.md
@@ -8,8 +8,6 @@
 
 ```shell
 git clone --single-branch https://github.com/buqiyuan/vite-vue3-lowcode.git
-# or
-git clone --single-branch https://gitee.com/buqiyuan/vite-vue3-lowcode.git
 ```
 
 ## technology stack
@@ -67,6 +65,22 @@ JSON.stringify(
 ).replaceAll('"', '')
 ```
 
+```javascript
+// 在vant文档中 chrome控制台输入以下代码,快速生成组件事件
+JSON.stringify(
+  $$('#events + table tbody tr').reduce((prev, curr) => {
+    const children = curr.children
+    const event = {
+      label: children[1].textContent,
+      value: children[0].textContent
+    }
+    return prev.concat([event])
+  }, [])
+)
+  .replaceAll(/(? {
-      const { bgImage, bgColor } = currentPage.config
-      const bodyStyleStr = `
+      if (currentPage?.config) {
+        const { bgImage, bgColor } = currentPage.config
+        const bodyStyleStr = `
             body {
                   background-color: ${bgColor};
                   background-image: url(${bgImage});
                 }
              `
-      document.styleSheets[0].insertRule(bodyStyleStr)
+        document.styleSheets[0].insertRule(bodyStyleStr)
+      }
     })
 
     return {
diff --git a/src/packages/base-widgets/datetimePicker/index.tsx b/src/packages/base-widgets/datetimePicker/index.tsx
index 463a58e..e79cebc 100644
--- a/src/packages/base-widgets/datetimePicker/index.tsx
+++ b/src/packages/base-widgets/datetimePicker/index.tsx
@@ -9,7 +9,7 @@ import {
   createEditorSelectProp,
   createEditorSwitchProp
 } from '@/visual-editor/visual-editor.props'
-import { getCurrentInstance, reactive } from 'vue'
+import { useAttrs, reactive } from 'vue'
 import { isDate } from '@/visual-editor/utils/is'
 import dayjs from 'dayjs'
 
@@ -29,7 +29,7 @@ export default {
   render: ({ styles, block, props }) => {
     const { registerRef } = useGlobalProperties()
 
-    const { attrs } = getCurrentInstance()!
+    const attrs = useAttrs()
 
     const state = reactive({
       showPicker: false,
diff --git a/src/packages/base-widgets/nav-bar/index.tsx b/src/packages/base-widgets/nav-bar/index.tsx
index abe6e4a..e8370fa 100644
--- a/src/packages/base-widgets/nav-bar/index.tsx
+++ b/src/packages/base-widgets/nav-bar/index.tsx
@@ -1,7 +1,7 @@
 /*
  * @Author: 卜启缘
  * @Date: 2021-05-04 05:36:58
- * @LastEditTime: 2021-07-07 10:56:56
+ * @LastEditTime: 2021-07-11 16:36:05
  * @LastEditors: 卜启缘
  * @Description: 导航栏
  * @FilePath: \vite-vue3-lowcode\src\packages\base-widgets\nav-bar\index.tsx
@@ -19,23 +19,37 @@ export default {
   preview: () => (