t20-common-lib 0.11.2 → 0.11.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.
package/README.md CHANGED
@@ -0,0 +1,10 @@
1
+ # 登录 npm 账号(需先在 npm 官网注册)
2
+ npm login
3
+
4
+ # 自动更新版本号(语义化版本,选其一)
5
+ npm version patch # 小补丁(1.0.0 → 1.0.1)
6
+ npm version minor # 次版本(1.0.0 → 1.1.0)
7
+ npm version major # 主版本(1.0.0 → 2.0.0)
8
+
9
+ # 发布到 npm 仓库(更新和首次发布命令一致)
10
+ npm publish
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "t20-common-lib",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "T20",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -158,8 +158,29 @@ export default {
158
158
  this.fetchBranchData(true);
159
159
  },
160
160
  handleBranchChange(val) {
161
+ // 保持 v-model 行为
161
162
  this.$emit('input', val);
162
- this.$emit("canGetData", val);
163
+
164
+ // 尝试从已加载的列表中找到完整的 item 对象
165
+ const findByValueKey = (v) => {
166
+ if (v === undefined || v === null) return null;
167
+ return this.branchBankList.find(item => item[this.valueKey] == v) || null;
168
+ };
169
+
170
+ let option = null;
171
+ if (this.multiple) {
172
+ // 多选时 val 应为数组,映射回对应的对象数组,过滤掉未找到的项
173
+ if (Array.isArray(val)) {
174
+ option = val.map(v => findByValueKey(v)).filter(i => i != null);
175
+ } else {
176
+ option = [];
177
+ }
178
+ } else {
179
+ // 单选时返回对应对象或 null
180
+ option = findByValueKey(val) || null;
181
+ }
182
+
183
+ this.$emit('canGetData', val, option);
163
184
  },
164
185
  handleFocus() {
165
186
  if (!this.page.key && this.branchBankList.length === 0) {