xianniu-ui 0.3.6 → 0.3.7

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": "xianniu-ui",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -3,16 +3,7 @@
3
3
  <el-form ref="form" inline :model="form" :label-width="labelWidth">
4
4
  <el-row :gutter="0" class="xn-search--row">
5
5
  <template v-for="(item, idx) in formData">
6
- <el-col
7
- :xs="24"
8
- :sm="12"
9
- :md="8"
10
- :lg="6"
11
- :xl="6"
12
- :offset="0"
13
- :key="idx"
14
- v-show="item.isShow || isColl"
15
- >
6
+ <el-col v-bind="{ ...col }" :key="idx" v-show="item.isShow || isColl">
16
7
  <el-form-item
17
8
  v-if="item.type === 'city'"
18
9
  :key="idx"
@@ -35,7 +26,7 @@
35
26
  >
36
27
  <el-input
37
28
  style="width: 100%"
38
- v-bind="item.options ? {...item.options} : {}"
29
+ v-bind="item.options ? { ...item.options } : {}"
39
30
  v-model="form.value[idx].modelVal"
40
31
  :clearable="item.clearable || true"
41
32
  :placeholder="item.placeholder || '请填写' + item.label"
@@ -49,12 +40,12 @@
49
40
  class="xn-search--row_col"
50
41
  >
51
42
  <el-select
52
- style="width:100%"
43
+ style="width: 100%"
53
44
  v-model="form.value[idx].modelVal"
54
45
  :placeholder="item.placeholder || '请选择' + item.label"
55
46
  :clearable="item.clearable || true"
56
47
  filterable
57
- v-bind="item.options ? {...item.options} : {}"
48
+ v-bind="item.options ? { ...item.options } : {}"
58
49
  :remote="isRemote(item.remote)"
59
50
  :reserve-keyword="isRemote(item.remote)"
60
51
  :default-first-option="isRemote(item.remote)"
@@ -101,7 +92,7 @@
101
92
  </el-form-item>
102
93
  </el-col>
103
94
  </template>
104
- <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" :offset="0">
95
+ <el-col v-bind="{ ...col }">
105
96
  <el-form-item :style="{ 'padding-left': `${labelWidth}` }">
106
97
  <el-button type="primary" icon="el-icon-search" @click="onSearch"
107
98
  >查询</el-button
@@ -111,9 +102,12 @@
111
102
  v-if="formData.length && formData.length > 4"
112
103
  type="text"
113
104
  @click="isColl = !isColl"
114
- ><span>{{ isColl ? "收起" : "高级查询" }}</span
115
- ><i class="ml-5" :class="toggle"></i
116
- ></el-button>
105
+ >
106
+ <template v-if="showColl">
107
+ <span>{{ isColl ? "收起" : "高级查询" }}</span
108
+ ><i class="ml-5" :class="toggle"></i>
109
+ </template>
110
+ </el-button>
117
111
  </el-form-item>
118
112
  </el-col>
119
113
  </el-row>
@@ -133,12 +127,32 @@ export default {
133
127
  type: String,
134
128
  default: "110px",
135
129
  },
130
+ span: {
131
+ type: Number,
132
+ default: null,
133
+ },
134
+ showColl: {
135
+ type: Boolean,
136
+ default: true,
137
+ },
136
138
  },
137
139
  computed: {
138
- isRemote(){
139
- return (val)=>{
140
- return val && typeof val === 'function'
141
- }
140
+ col() {
141
+ const { span } = this;
142
+ return {
143
+ span,
144
+ xs: span ? span : 24,
145
+ sm: span ? span : 12,
146
+ md: span ? span : 8,
147
+ lg: span ? span : 6,
148
+ xl: span ? span : 6,
149
+ offset: 0,
150
+ };
151
+ },
152
+ isRemote() {
153
+ return (val) => {
154
+ return val && typeof val === "function";
155
+ };
142
156
  },
143
157
  _formData() {
144
158
  return this.formData;
@@ -191,7 +205,7 @@ export default {
191
205
  created() {
192
206
  for (let i = 0, formData = this.formData; i < formData.length; i++) {
193
207
  const item = formData[i];
194
- item.isShow = i > 3 ? false : true;
208
+ item.isShow = i > 3 && this.showColl ? false : true;
195
209
  this.form.value.push({
196
210
  key: item.prop,
197
211
  modelVal: "",
@@ -249,7 +263,7 @@ export default {
249
263
  const row =
250
264
  this.formData && this.formData.find((item) => item.label === key);
251
265
  this.$set(row, "data", data);
252
- }
266
+ },
253
267
  },
254
268
  };
255
269
  </script>