fit2cloud-ui-plus 0.0.1-beta.0 → 0.0.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/.editorconfig +14 -0
  2. package/BETA.MD +6 -0
  3. package/env.d.ts +13 -0
  4. package/examples/App.vue +65 -0
  5. package/examples/assets/github.png +0 -0
  6. package/examples/assets/hidden-code.png +0 -0
  7. package/examples/assets/iconfont/demo.css +539 -0
  8. package/examples/assets/iconfont/demo_index.html +257 -0
  9. package/examples/assets/iconfont/iconfont.css +27 -0
  10. package/examples/assets/iconfont/iconfont.js +1 -0
  11. package/examples/assets/iconfont/iconfont.json +30 -0
  12. package/examples/assets/iconfont/iconfont.ttf +0 -0
  13. package/examples/assets/iconfont/iconfont.woff +0 -0
  14. package/examples/assets/iconfont/iconfont.woff2 +0 -0
  15. package/examples/assets/logo.png +0 -0
  16. package/examples/components/CodeExample.vue +209 -0
  17. package/examples/components/DocumentTable.vue +98 -0
  18. package/examples/components/Markdown.vue +30 -0
  19. package/examples/layout/components/AppHeader.vue +35 -0
  20. package/examples/layout/components/Sidebar.vue +73 -0
  21. package/examples/layout/index.vue +55 -0
  22. package/examples/layout/layout.scss +75 -0
  23. package/examples/main.ts +25 -0
  24. package/examples/markdown/getting-started.md +38 -0
  25. package/examples/pages/filter-bar/demo/BaseFilterBar.vue +70 -0
  26. package/examples/pages/filter-bar/demo/SetConditionsDemo.vue +66 -0
  27. package/examples/pages/filter-bar/demo/SlotDemo.vue +77 -0
  28. package/examples/pages/filter-bar/index.vue +56 -0
  29. package/examples/pages/index.ts +11 -0
  30. package/examples/pages/read-write-switch/demo/BaseDemo.vue +30 -0
  31. package/examples/pages/read-write-switch/demo/CustomContentDemo.vue +28 -0
  32. package/examples/pages/read-write-switch/demo/InputRwSwitchDemo.vue +16 -0
  33. package/examples/pages/read-write-switch/demo/ReadSwitchDemo.vue +54 -0
  34. package/examples/pages/read-write-switch/demo/SelectRwSwitchDemo.vue +23 -0
  35. package/examples/pages/read-write-switch/demo/TableInnerEditDemo.vue +73 -0
  36. package/examples/pages/read-write-switch/demo/WriteSwitchDemo.vue +39 -0
  37. package/examples/pages/read-write-switch/index.vue +81 -0
  38. package/examples/pages/speed-dial/demo/BaseSpeedDial.vue +51 -0
  39. package/examples/pages/speed-dial/demo/SpeedDialCustom.vue +109 -0
  40. package/examples/pages/speed-dial/demo/SpeedDialPosition.vue +66 -0
  41. package/examples/pages/speed-dial/demo/SpeedDialTrigger.vue +64 -0
  42. package/examples/pages/speed-dial/index.vue +61 -0
  43. package/examples/pages/split-pane/demo/BaseSplit.vue +36 -0
  44. package/examples/pages/split-pane/demo/CustomResizer.vue +47 -0
  45. package/examples/pages/split-pane/demo/NestSplit.vue +34 -0
  46. package/examples/pages/split-pane/demo/ResizerType.vue +60 -0
  47. package/examples/pages/split-pane/index.vue +61 -0
  48. package/examples/pages/table/demo/BaseTable.vue +35 -0
  49. package/examples/pages/table/demo/DropdownColumn.vue +89 -0
  50. package/examples/pages/table/demo/DropdownColumnSlot.vue +92 -0
  51. package/examples/pages/table/demo/SaveSelectColumn.vue +41 -0
  52. package/examples/pages/table/demo/SelectColumn.vue +47 -0
  53. package/examples/pages/table/demo/TableOperations.vue +95 -0
  54. package/examples/pages/table/demo/TablePagination.vue +100 -0
  55. package/examples/pages/table/index.vue +89 -0
  56. package/examples/pages/tabs/demo/AddCloseTab.vue +73 -0
  57. package/examples/pages/tabs/index.vue +42 -0
  58. package/examples/router/doc-routes.ts +52 -0
  59. package/examples/router/index.ts +56 -0
  60. package/index.html +13 -0
  61. package/lib/fit2cloud-ui-plus.es.js +37 -30
  62. package/lib/fit2cloud-ui-plus.umd.js +1 -1
  63. package/package.json +3 -6
  64. package/plugins/example-transform.ts +30 -0
  65. package/public/favicon.bmp +0 -0
  66. package/tsconfig.json +24 -0
  67. package/tsconfig.node.json +9 -0
  68. package/vite.config.ts +56 -0
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <div class="header-wrapper">
3
+ <div class="logo">
4
+ <img src="../../assets/logo.png" height="25" alt="" />
5
+ </div>
6
+ <div class="right">
7
+ <span class="version">{{ PackageJSON.version }}</span>
8
+ <a href="https://github.com/fit2cloud-ui/fit2cloud-ui" target="_blank"><img src="../../assets/github.png" height="30" alt="" /></a>
9
+ </div>
10
+ </div>
11
+ </template>
12
+ <script setup lang="ts">
13
+ import PackageJSON from "../../../package.json";
14
+ </script>
15
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
16
+ <style scoped lang="scss">
17
+ .header-wrapper {
18
+ // background-color: #fff;
19
+ text-align: center;
20
+ display: flex;
21
+ justify-content: space-between;
22
+ align-items: center;
23
+ align-content: center;
24
+ .logo {
25
+ margin-left: 15px;
26
+ }
27
+ .version {
28
+ font-size: 16px;
29
+ margin-right: 25px;
30
+ vertical-align: super;
31
+ color: #ffffff;
32
+ }
33
+ }
34
+ </style>
35
+
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <el-scrollbar>
3
+ <div class="sidebar" v-for="(item, index) in routes" :key="index">
4
+ <h1>{{ item.name }}</h1>
5
+ <ul v-for="(child, i) in item.children" :key="i">
6
+ <li
7
+ :class="{ active: showPath === Path(child.path, item.path) }"
8
+ @click="toPath(child.path, item.path)"
9
+ >
10
+ {{ child.name }}
11
+ </li>
12
+ </ul>
13
+ </div>
14
+ </el-scrollbar>
15
+ </template>
16
+
17
+ <script setup lang="ts">
18
+ import { ref, onMounted } from "vue";
19
+ import { useRoute, useRouter } from "vue-router";
20
+ import { routes } from "../../router/index";
21
+
22
+ const route = useRoute();
23
+ const router = useRouter();
24
+ const showPath = ref("");
25
+
26
+ onMounted(() => {
27
+ showPath.value = route.path || "/";
28
+ });
29
+
30
+ function Path(path: String, parentPath: String) {
31
+ return `${parentPath}/${path}`;
32
+ }
33
+
34
+ function toPath(path: String, parentPath: String) {
35
+ showPath.value = Path(path, parentPath);
36
+ router.push(Path(path, parentPath));
37
+ }
38
+ </script>
39
+ <style lang="scss" scoped>
40
+ $themeColor: #2d61a2;
41
+ .sidebar {
42
+ h1 {
43
+ font-size: 16px;
44
+ margin-top: 20px;
45
+ padding-left: 10px;
46
+ }
47
+ ul {
48
+ line-height: 35px;
49
+ color: #666666;
50
+ // margin-left:25px;
51
+ li {
52
+ cursor: pointer;
53
+ padding: 5px 0;
54
+ padding-left: 10px;
55
+ &:hover {
56
+ color: $themeColor;
57
+ }
58
+ }
59
+ .active {
60
+ background-color: #e6f7ff;
61
+ position: relative;
62
+ &::after {
63
+ content: "";
64
+ position: absolute;
65
+ top: 0;
66
+ right: 0;
67
+ bottom: 0;
68
+ border-left: 3px solid $themeColor;
69
+ }
70
+ }
71
+ }
72
+ }
73
+ </style>
@@ -0,0 +1,55 @@
1
+ <script setup lang="ts">
2
+ import AppHeader from "./components/AppHeader.vue";
3
+ import Sidebar from "./components/Sidebar.vue";
4
+ </script>
5
+
6
+ <template>
7
+ <div class="app-wrapper">
8
+ <div class="app-header">
9
+ <app-header>header</app-header>
10
+ </div>
11
+ <div class="app-container">
12
+ <el-scrollbar class="page-component__scroll" ref="componentScrollBar">
13
+ <div class="app-main">
14
+ <sidebar class="sidebar-container" />
15
+ <div class="main-wrapper">
16
+ <router-view></router-view>
17
+ </div>
18
+ </div>
19
+ </el-scrollbar>
20
+ </div>
21
+ </div>
22
+ </template>
23
+
24
+ <style lang="scss" scoped>
25
+ @use "./layout.scss" as *;
26
+ .app-wrapper {
27
+ height: 100%;
28
+ width: 100%;
29
+ }
30
+ .app-header {
31
+ position: fixed;
32
+ width: 100%;
33
+ left: 0;
34
+ top: 0;
35
+ background-color: #004a71;
36
+ box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
37
+ z-index: 1500;
38
+ }
39
+ .app-container {
40
+ height: 100%;
41
+ padding: 0;
42
+ }
43
+ .app-main {
44
+ width: 1140px;
45
+ margin: 0 auto;
46
+ }
47
+
48
+ .main-wrapper {
49
+
50
+ // width: 100%;
51
+ :v-deep.page-container {
52
+ position: relative;
53
+ }
54
+ }
55
+ </style>
@@ -0,0 +1,75 @@
1
+ $headerHeight: 70px;
2
+ $sideBarWidth: 270px;
3
+ $themeColor: #2d61a2;
4
+
5
+ .header-wrapper {
6
+ height: $headerHeight;
7
+ width: 1140px;
8
+ padding: 0;
9
+ margin: 0 auto;
10
+ // line-height: $headerHeight;
11
+ // border-bottom: 1px solid #dcdfe6;
12
+ }
13
+
14
+ .page-component__scroll {
15
+ height: calc(100vh - #{$headerHeight});
16
+ margin-top: $headerHeight;
17
+ }
18
+
19
+ .sidebar-container {
20
+ transition: width 0.28s;
21
+ width: $sideBarWidth !important;
22
+ height: calc(100% - #{$headerHeight});
23
+ position: fixed;
24
+ top: $headerHeight;
25
+ bottom: 0;
26
+ z-index: 88;
27
+ overflow: hidden;
28
+ border-right: 1px solid #f0f0f0;
29
+ }
30
+
31
+ .main-wrapper {
32
+ padding: 32px 50px 50px $sideBarWidth + 30px;
33
+ }
34
+
35
+ .attributesButton {
36
+ color: $themeColor;
37
+ }
38
+
39
+ @media (max-width: 1200px) {
40
+
41
+ .header-wrapper {
42
+ width: 100%;
43
+ }
44
+
45
+ .app-main {
46
+ width: 100% !important;
47
+ }
48
+
49
+ .attributesButton {
50
+ right: 0;
51
+ }
52
+
53
+ .is-fixed {
54
+ right: 0;
55
+ }
56
+ }
57
+
58
+ @media (min-width: 1600px) {
59
+
60
+ .header-wrapper {
61
+ width: 80%;
62
+ }
63
+
64
+ .app-main {
65
+ width: 80% !important;
66
+ }
67
+
68
+ .attributesButton {
69
+ right: 8%;
70
+ }
71
+
72
+ .is-fixed {
73
+ right: 10%;
74
+ }
75
+ }
@@ -0,0 +1,25 @@
1
+ import { createApp } from 'vue'
2
+ import App from './App.vue'
3
+ // 整体引入
4
+ import Fit2CloudPlus from '@/index'
5
+ import ElementPlus from 'element-plus'
6
+ import * as ElementPlusIconsVue from '@element-plus/icons-vue'
7
+ import router from "./router/index";
8
+ // import pages from './pages/index'
9
+ import CodeExample from "./components/CodeExample.vue";
10
+ import "github-markdown-css";
11
+
12
+ // UI样式
13
+ import '@/styles/index.scss';
14
+
15
+ const app = createApp(App);
16
+ // pages(app)
17
+ app.use(router).use(ElementPlus, { size: 'default', zIndex: 3000 })
18
+ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
19
+ app.component(key, component)
20
+ }
21
+ app.use(Fit2CloudPlus);
22
+ app.component('code-example', CodeExample)
23
+
24
+
25
+ app.mount("#app");
@@ -0,0 +1,38 @@
1
+ # 快速上手
2
+
3
+ FIT2CLOUD UI 是基于Element UI二次开发的Vue组件库,提供企业软件开发时常用的组件,过滤器,指令等
4
+
5
+ ## 安装
6
+
7
+ 推荐使用 npm 的方式安装,它能更好地和 webpack 打包工具配合使用。
8
+
9
+ ```
10
+ npm install fit2cloud-ui
11
+ ```
12
+
13
+ 使用时需要安装Element UI
14
+
15
+ ```
16
+ npm install element-ui
17
+ ```
18
+
19
+
20
+ ## 完整引入
21
+
22
+ 在 main.js 中写入以下内容:
23
+
24
+ ```
25
+ import Vue from 'vue';
26
+ import ElementUI from 'element-ui'
27
+ import Fit2CloudUI from 'fit2cloud-ui';
28
+ import "fit2cloud-ui/src/styles/index.scss"; // 已经包含了element ui的scss
29
+ import App from './App.vue';
30
+
31
+ Vue.use(ElementUI);
32
+ Vue.use(Fit2CloudUI);
33
+
34
+ new Vue({
35
+ el: '#app',
36
+ render: h => h(App)
37
+ });
38
+ ```
@@ -0,0 +1,70 @@
1
+ <demo>基本用法</demo>
2
+ <template>
3
+ <div>
4
+ <div>
5
+ <h4>
6
+ 1、使用slot
7
+ </h4>
8
+ <FuFilterBar ref="filterRef" @exec="exec" :result-count="count" size="small">
9
+ <template #default>
10
+ <FuFilterSelect size="small" label="事件类型" field="type" :options="options" multiple clearable filterable use-select-all/>
11
+ <FuFilterDate size="small" label="操作日期" field="date" />
12
+ <FuFilterDateTime size="small" label="操作时间" field="datetime" />
13
+ </template>
14
+ </FuFilterBar>
15
+ <h4>
16
+ 1、使用components传参
17
+ </h4>
18
+ <fu-filter-bar ref="filterRef" @exec="exec" :result-count="count" size="small" :components="components" />
19
+ </div>
20
+ <pre class="condition_display">{{ condition }}</pre>
21
+ </div>
22
+ </template>
23
+
24
+ <script setup lang="ts">
25
+ import { ref } from "vue"
26
+
27
+ const options = [{ label: "选项1", value: 1 },
28
+ { label: "选项2", value: 2 },
29
+ { label: "选项3", value: 3 },
30
+ { label: "选项4", value: 4 },
31
+ { label: "选项5", value: 5 },
32
+ { label: "选项6", value: 6 },
33
+ { label: "选项7", value: 7 },
34
+ { label: "选项8", value: 8 },
35
+ { label: "选项9", value: 9 },
36
+ { label: "选项10", value: 10 },
37
+ ]
38
+ const components = [
39
+ {
40
+ field: "groups",
41
+ label: "区域",
42
+ component: "FuFilterSelect",
43
+ options: [{ label: "北区", value: "1" }, { label: "南区", value: "2" }, { label: "东区", value: "3" }],
44
+ multiple: true,
45
+ clearable: true,
46
+ filterable: true
47
+ },
48
+ {
49
+ field: "date",
50
+ label: "操作日期",
51
+ component: "FuFilterDate"
52
+ }
53
+ ]
54
+
55
+ const count = ref(0)
56
+ const condition = ref({})
57
+
58
+ function exec(c: any) {
59
+ condition.value = c
60
+ count.value = Object.keys(condition).length * 10
61
+ }
62
+ </script>
63
+
64
+ <style lang="scss" scoped>
65
+ .condition_display {
66
+ width: 100%;
67
+ overflow-y: auto;
68
+ background-color: #f5f9ff;
69
+ }
70
+ </style>
@@ -0,0 +1,66 @@
1
+ <demo>回显条件</demo>
2
+ <template>
3
+ <div>
4
+ <div>
5
+ <fu-filter-bar ref="filterRef" @exec="exec" :result-count="count" size="small">
6
+ <template #default>
7
+ <fu-filter-select size="small" label="事件类型" field="event_type" :options="options" clearable filterable />
8
+ <fu-filter-select size="small" label="操作用户" field="user" :options="users" multiple clearable filterable />
9
+ <fu-filter-date size="small" label="操作日期" field="date" />
10
+ <fu-filter-date-time size="small" label="操作时间" field="datetime" />
11
+ </template>
12
+ </fu-filter-bar>
13
+ </div>
14
+ <pre class="condition_display">{{ condition }}</pre>
15
+ </div>
16
+ </template>
17
+
18
+ <script setup lang="ts">
19
+ import { ref, onMounted, nextTick } from "vue"
20
+ const options = [{ label: "选项1", value: 1 },
21
+ { label: "选项2", value: 2 },
22
+ { label: "选项3", value: 3 },
23
+ { label: "选项4", value: 4 },
24
+ { label: "选项5", value: 5 },
25
+ { label: "选项6", value: 6 },
26
+ { label: "选项7", value: 7 },
27
+ { label: "选项8", value: 8 },
28
+ { label: "选项9", value: 9 },
29
+ { label: "选项10", value: 10 },
30
+ ]
31
+ const users = [{ label: "用户1", value: 1 },
32
+ { label: "用户2", value: 2 },
33
+ { label: "用户3", value: 3 },
34
+ { label: "用户4", value: 4 },
35
+ { label: "用户5", value: 5 },
36
+ { label: "用户6", value: 6 },
37
+ { label: "用户7", value: 7 },
38
+ { label: "用户8", value: 8 },
39
+ { label: "用户9", value: 9 },
40
+ { label: "用户10", value: 10 },
41
+ ]
42
+ const count = ref(0)
43
+ const condition = ref({})
44
+ const filterRef = ref()
45
+
46
+ function init() {
47
+ filterRef.value?.setConditions({ user: { value: [2, 3, 4] } })
48
+ }
49
+ function exec(c: any) {
50
+ condition.value = c
51
+ count.value = Object.keys(c).length * 10
52
+ }
53
+ onMounted(() => {
54
+ nextTick(() => {
55
+ init()
56
+ });
57
+ })
58
+ </script>
59
+
60
+ <style lang="scss" scoped>
61
+ .condition_display {
62
+ width: 100%;
63
+ overflow-y: auto;
64
+ background-color: #f5f9ff;
65
+ }
66
+ </style>
@@ -0,0 +1,77 @@
1
+ <demo>插槽示例</demo>
2
+ <template>
3
+ <div>
4
+ <div>
5
+ <fu-filter-bar ref="filter" @exec="exec" :result-count="count" size="small">
6
+ <template #tl>
7
+ <el-button>导出数据</el-button>
8
+ </template>
9
+ <template #default>
10
+ <fu-filter-select size="small" label="事件类型" field="type" :options="options" multiple clearable filterable />
11
+ <fu-filter-date size="small" label="操作日期" field="date" />
12
+ <fu-filter-date-time size="small" label="操作时间" field="datetime" />
13
+ </template>
14
+ <template #buttons>
15
+ <fu-table-column-select type="button" :columns="columns" size="small"/>
16
+ </template>
17
+ </fu-filter-bar>
18
+ </div>
19
+ <pre class="condition_display">{{ condition }}</pre>
20
+ <fu-table :data="tableData" :columns="columns">
21
+ <el-table-column type="selection"></el-table-column>
22
+ <el-table-column prop="date" label="日期" min-width="120"></el-table-column>
23
+ <el-table-column prop="name" label="姓名" min-width="120"></el-table-column>
24
+ <el-table-column prop="address" label="地址"></el-table-column>
25
+ </fu-table>
26
+ </div>
27
+ </template>
28
+
29
+ <script setup lang="ts">
30
+ import { ref } from "vue"
31
+ const options = [{ label: "选项1", value: 1 },
32
+ { label: "选项2", value: 2 },
33
+ { label: "选项3", value: 3 },
34
+ { label: "选项4", value: 4 },
35
+ { label: "选项5", value: 5 },
36
+ { label: "选项6", value: 6 },
37
+ { label: "选项7", value: 7 },
38
+ { label: "选项8", value: 8 },
39
+ { label: "选项9", value: 9 },
40
+ { label: "选项10", value: 10 },
41
+ ]
42
+
43
+ const tableData= [{
44
+ date: "2016-05-02",
45
+ name: "张三",
46
+ address: "北京朝阳区财富中心 0室",
47
+ }, {
48
+ date: "2016-05-04",
49
+ name: "张三",
50
+ address: "北京朝阳区财富中心 1室",
51
+ }, {
52
+ date: "2016-05-01",
53
+ name: "张三",
54
+ address: "北京朝阳区财富中心 2室",
55
+ }, {
56
+ date: "2016-05-03",
57
+ name: "张三",
58
+ address: "北京朝阳区财富中心 3室",
59
+ }]
60
+ const count = ref(0)
61
+ const condition = ref({})
62
+ const columns= ref([])
63
+
64
+ function exec(condition: any) {
65
+ condition.value = condition
66
+ count.value = Object.keys(condition).length * 10
67
+ }
68
+
69
+ </script>
70
+
71
+ <style lang="scss" scoped>
72
+ .condition_display {
73
+ width: 100%;
74
+ overflow-y: auto;
75
+ background-color: #f5f9ff;
76
+ }
77
+ </style>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div>
3
+ <!-- 一级标题 -->
4
+ <h1 class="component-h1">FilterBar 筛选条</h1>
5
+ <!-- 一级描述 -->
6
+ <p>搜索条,提供快速搜索,高级搜索,自定义按钮</p>
7
+ <!-- BaseTable内容 -->
8
+ <div class="component-block" v-for="(item, index) in comList" :key="index">
9
+ <h2>{{ item.title }}</h2>
10
+ <p>{{ item.titleDesc }}</p>
11
+ <code-example :description="item.description" :component="item.component" />
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script setup lang="ts">
17
+ import BaseFilterBar from "./demo/BaseFilterBar.vue";
18
+ import SetConditionsDemo from "./demo/SetConditionsDemo.vue";
19
+ import SlotDemo from "./demo/SlotDemo.vue";
20
+
21
+ const comList = [
22
+ {
23
+ title: "基本用法",
24
+ titleDesc: "使用FilterBar",
25
+ component: BaseFilterBar,
26
+ },
27
+ {
28
+ title: "回显条件",
29
+ titleDesc: "设置初始条件,搜索框自动回显",
30
+ component: SetConditionsDemo,
31
+ description: `筛选组件需要提供init和getCondition方法,如果在mounted中初始化必须使用this.$nextTick`
32
+ },
33
+ {
34
+ title: "插槽示例",
35
+ titleDesc: "可以通过插槽设置上部左侧内容、上部右侧内容",
36
+ component: SlotDemo,
37
+ }
38
+ ]
39
+ </script>
40
+
41
+ <style lang="scss" scoped>
42
+ .component-block {
43
+ margin-top: 40px;
44
+
45
+ p {
46
+ font-size: 14px;
47
+ color: #5e6d82;
48
+ line-height: 1.5em;
49
+ }
50
+
51
+ h2 {
52
+ font-weight: 400;
53
+ color: #1f2f3d;
54
+ }
55
+ }
56
+ </style>
@@ -0,0 +1,11 @@
1
+ /* Components */
2
+ import type { App } from "vue";
3
+
4
+ const pages = (app:App)=>{
5
+ const components= import.meta.globEager('./*/index.vue')
6
+ Object.keys(components).forEach(key => {
7
+ let component = components[key].default
8
+ app.component(component.name, component)
9
+ })
10
+ }
11
+ export default pages
@@ -0,0 +1,30 @@
1
+ <demo>基本用法</demo>
2
+ <template>
3
+ <div style="line-height: 40px;">
4
+ <fu-read-write-switch :data="input" v-model="write" @change="change">
5
+ <el-input v-model="input" @blur="blur" @keydown="keydown" />
6
+ </fu-read-write-switch>
7
+ </div>
8
+ </template>
9
+
10
+ <script setup lang="ts">
11
+ import { ref } from "vue"
12
+ const write = ref(false)
13
+ const input = ref("单击填写")
14
+
15
+ function change(obj: any) {
16
+ console.log(obj)
17
+ }
18
+ function read() {
19
+ write.value = false
20
+ }
21
+ function blur() {
22
+ read()
23
+ }
24
+ function keydown(e: Event) {
25
+ const event = e as KeyboardEvent
26
+ if (event.key === "Enter") {
27
+ read()
28
+ }
29
+ }
30
+ </script>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <div style="line-height: 40px;">
3
+ <fu-read-write-switch>
4
+ <!-- 自定义读内容 v-slot:read -->
5
+ <template #read>
6
+ <div>自定义读内容: {{ input }}</div>
7
+ </template>
8
+
9
+ <!-- 自定义写内容 v-slot:default -->
10
+ <template #default="{read}">
11
+ 自定义写内容:
12
+ <el-input v-model="input" @blur="read" style="width: 200px"/>
13
+ </template>
14
+ </fu-read-write-switch>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: "CustomContentDemo",
21
+ data() {
22
+ return {
23
+ write: false,
24
+ input: "单击填写"
25
+ }
26
+ }
27
+ }
28
+ </script>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <div>
3
+ <fu-input-rw-switch v-model="input" placeholder="单击填写"/>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: "InputRwSwitchDemo",
10
+ data() {
11
+ return {
12
+ input: "单击填写"
13
+ }
14
+ }
15
+ }
16
+ </script>