@befly-addon/admin 1.1.33 → 1.1.34

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@befly-addon/admin",
3
- "version": "1.1.33",
3
+ "version": "1.1.34",
4
4
  "private": false,
5
5
  "description": "Befly - 管理后台功能组件",
6
6
  "keywords": [
@@ -65,6 +65,6 @@
65
65
  "access": "public",
66
66
  "registry": "https://registry.npmjs.org"
67
67
  },
68
- "gitHead": "cd0f2c4451d6ec5ead541735e6ee086611a5b3f4",
68
+ "gitHead": "d3b9b53e96eef8b4157e7a639e21fed9b90aafb5",
69
69
  "title": "管理后台"
70
70
  }
@@ -23,6 +23,8 @@
23
23
  </template>
24
24
 
25
25
  <script setup>
26
+ import { computed } from "vue";
27
+
26
28
  import { Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Select as TSelect, Option as TOption, Textarea as TTextarea, InputNumber as TInputNumber, MessagePlugin } from "tdesign-vue-next";
27
29
  import { $Http } from "@/plugins/http";
28
30
 
@@ -90,25 +92,18 @@ const $Method = {
90
92
  }
91
93
  };
92
94
 
93
- watch(
94
- () => props.modelValue,
95
- (val) => {
96
- if (val) {
97
- if (props.actionType === "upd" && props.rowData) {
98
- $Data.formData.typeCode = props.rowData.typeCode || "";
99
- $Data.formData.key = props.rowData.key || "";
100
- $Data.formData.label = props.rowData.label || "";
101
- $Data.formData.sort = props.rowData.sort || 0;
102
- $Data.formData.remark = props.rowData.remark || "";
103
- } else {
104
- $Data.formData.typeCode = "";
105
- $Data.formData.key = "";
106
- $Data.formData.label = "";
107
- $Data.formData.sort = 0;
108
- $Data.formData.remark = "";
109
- }
110
- }
111
- },
112
- { immediate: true }
113
- );
95
+ // 该组件由父组件 v-if 控制挂载/卸载,因此无需 watch:创建时初始化一次即可
96
+ if (props.actionType === "upd" && props.rowData) {
97
+ $Data.formData.typeCode = props.rowData.typeCode || "";
98
+ $Data.formData.key = props.rowData.key || "";
99
+ $Data.formData.label = props.rowData.label || "";
100
+ $Data.formData.sort = props.rowData.sort || 0;
101
+ $Data.formData.remark = props.rowData.remark || "";
102
+ } else {
103
+ $Data.formData.typeCode = "";
104
+ $Data.formData.key = "";
105
+ $Data.formData.label = "";
106
+ $Data.formData.sort = 0;
107
+ $Data.formData.remark = "";
108
+ }
114
109
  </script>
@@ -71,6 +71,8 @@
71
71
  </template>
72
72
 
73
73
  <script setup>
74
+ import { onMounted } from "vue";
75
+
74
76
  import { Button as TButton, Table as TTable, Input as TInput, Select as TSelect, Option as TOption, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from "tdesign-vue-next";
75
77
  import ILucidePlus from "~icons/lucide/plus";
76
78
  import ILucideRotateCw from "~icons/lucide/rotate-cw";
@@ -18,6 +18,8 @@
18
18
  </template>
19
19
 
20
20
  <script setup>
21
+ import { computed } from "vue";
22
+
21
23
  import { Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, MessagePlugin } from "tdesign-vue-next";
22
24
  import { $Http } from "@/plugins/http";
23
25
 
@@ -83,23 +85,16 @@ const $Method = {
83
85
  }
84
86
  };
85
87
 
86
- watch(
87
- () => props.modelValue,
88
- (val) => {
89
- if (val) {
90
- if (props.actionType === "upd" && props.rowData) {
91
- $Data.formData.code = props.rowData.code || "";
92
- $Data.formData.name = props.rowData.name || "";
93
- $Data.formData.description = props.rowData.description || "";
94
- $Data.formData.sort = props.rowData.sort || 0;
95
- } else {
96
- $Data.formData.code = "";
97
- $Data.formData.name = "";
98
- $Data.formData.description = "";
99
- $Data.formData.sort = 0;
100
- }
101
- }
102
- },
103
- { immediate: true }
104
- );
88
+ // 该组件由父组件 v-if 控制挂载/卸载,因此无需 watch:创建时初始化一次即可
89
+ if (props.actionType === "upd" && props.rowData) {
90
+ $Data.formData.code = props.rowData.code || "";
91
+ $Data.formData.name = props.rowData.name || "";
92
+ $Data.formData.description = props.rowData.description || "";
93
+ $Data.formData.sort = props.rowData.sort || 0;
94
+ } else {
95
+ $Data.formData.code = "";
96
+ $Data.formData.name = "";
97
+ $Data.formData.description = "";
98
+ $Data.formData.sort = 0;
99
+ }
105
100
  </script>
@@ -68,6 +68,8 @@
68
68
  </template>
69
69
 
70
70
  <script setup>
71
+ import { onMounted } from "vue";
72
+
71
73
  import { Button as TButton, Table as TTable, Input as TInput, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from "tdesign-vue-next";
72
74
  import ILucidePlus from "~icons/lucide/plus";
73
75
  import ILucideRotateCw from "~icons/lucide/rotate-cw";
@@ -45,7 +45,6 @@
45
45
  </template>
46
46
 
47
47
  <script setup>
48
- import { watch } from "vue";
49
48
  import { Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, Select as TSelect, Option as TOption, RadioGroup as TRadioGroup, Radio as TRadio, Button as TButton, MessagePlugin } from "tdesign-vue-next";
50
49
  import { $Http } from "@/plugins/http";
51
50
 
@@ -165,15 +164,8 @@ const $Method = {
165
164
  }
166
165
  };
167
166
 
168
- watch(
169
- () => $Prop.modelValue,
170
- (val) => {
171
- if (val) {
172
- $Method.initData();
173
- }
174
- },
175
- { immediate: true }
176
- );
167
+ // 该组件由父组件 v-if 控制挂载/卸载,因此无需 watch:创建时初始化一次即可
168
+ $Method.initData();
177
169
  </script>
178
170
 
179
171
  <style scoped lang="scss"></style>