diff --git a/examples/views/docs/component/schema-select.md b/examples/views/docs/component/schema-select.md
index 1e449b7..b12b4a8 100644
--- a/examples/views/docs/component/schema-select.md
+++ b/examples/views/docs/component/schema-select.md
@@ -103,6 +103,62 @@ export default {
:::
+## 保持输入值
+
+若没有查询到相关结果时,允许保持当前输入值为绑定值。
+
+::: snippet 设置`allow-create`允许创建数据源之外的新值。
+
+```html
+
+
+
+ {{ model }}
+
+
+
+
+```
+
+:::
+
## 设置默认文本
通常情况下,编辑表单时,若未加载搜索接口,则需要给定一个对应当前值的默认显示的文本
diff --git a/packages/schema-select/index.vue b/packages/schema-select/index.vue
index c15c98f..11611b6 100644
--- a/packages/schema-select/index.vue
+++ b/packages/schema-select/index.vue
@@ -116,13 +116,14 @@ export default {
type: String,
default: 'value',
},
- 'value-filter': {
+ allowCreate: Boolean,
+ valueFilter: {
type: Object,
default() {
return {};
},
},
- 'api-search': Function,
+ apiSearch: Function,
},
inject: {
elForm: {
@@ -232,10 +233,15 @@ export default {
this.query = this.model;
if (this.$refs.schema) {
this.$refs.schema.search();
+ if (this.allowCreate) {
+ this.$emit('input', this.query);
+ }
}
},
onInputFocus() {
- this.model = '';
+ if (!this.allowCreate) {
+ this.model = '';
+ }
},
onInputBlur() {
if (!this.visible) {
--
libgit2 0.21.0