@soei/flyweight 0.0.5 → 0.0.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/README.md CHANGED
@@ -9,6 +9,20 @@
9
9
 
10
10
  ### 更新日志
11
11
 
12
+ ### `0.0.7`
13
+
14
+ - #### 新增 `:auto`, 默认值: `false`
15
+
16
+ 当 `auto` 为 `true` 时, `:width` 赋值会被视为 `最小值`, 剩余空间自动填充
17
+
18
+ ```html
19
+ <s-flyweight :auto="true" :width="100"></s-flyweight>
20
+ ```
21
+
22
+ ### `0.0.6`
23
+
24
+ - #### 优化 `flys` 初始化赋值,不改变时,获取 length 问题
25
+
12
26
  ### `0.0.5`
13
27
 
14
28
  - #### 扩展 `width` 赋值
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@soei/util"),o=require("vue");const v=(e,t)=>{const l=e.__vccOpts||e;for(const[n,i]of t)l[n]=i;return l};let b=e=>e==null||e==null,z=/(\d+|[+\-\*/]|%)/g,m={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t,l)=>parseFloat(e)/100*l},k=(e,t)=>{let l;if(l=u.runer("match",e,z)){let n=l.length,i,h=0,s,r=[];for(;n--;)h=l.shift(),h in m?(i&&r.push(i),h==="%"&&(r.length=2),s=h):+h&&r.push(+h),r.length==2&&(r.push(t),i=m[s].apply(null,r),r.length=0);+i||(i=+r.pop()),e=i>>0}return e},T=(...e)=>{console.info("::::FLYWEIGHT",...e)};const H={name:"Flyweight",props:{flys:{type:Array,default:()=>[]},width:{type:Number,default:0},height:{type:Number,default:100},offset:{type:Array,default:()=>[0,0]},lazy:{type:Number,default:100},view:{type:Object,default:()=>null},index:{type:Number,default:0},top:{type:Number,default:!1},left:{type:Number,default:!1}},computed:{flyweight(){return this.$refs.flyweight}},data(){return{flyweights:[],actice:!1,Height:null,column:1,row:1,fwheight:10,count:0,task:[],realW:0,realH:0}},watch:{flys(e){this.count=e.length,this.re();let t=this.task.shift();t&&this.$nextTick(()=>{this.setview(t)})},view:{handler(e){this.setview(e)},immediate:!0},index(e){this.setindex(e)},top(e){this.flyweight.scrollTop=e},left(e){this.flyweight.scrollLeft=e}},mounted(){this.flyweights=[],this.$set||(this.$set=(e,t,l)=>{e[t]=l}),this.setindex(this.index);try{new ResizeObserver(()=>{this.re(),this.$emit("resize")}).observe(this.flyweight)}catch(e){T(e)}},methods:{trigger(e){this.lazyrun(()=>this.$emit(e,!0))},cheackflys(e){if(!this.flys.length)return e&&this.task.push(e),!0},setview(e){u.runer([this.cheackflys,t=>{t=t||{};let l=t.index||u.each(this.flys,(n,i,h,s)=>{if(i[h]==s)return n},t.picker,t.id);b(l)||this.setindex(l)}],this,e)},setindex(e){u.runer([this.cheackflys,({index:t})=>{this.$nextTick(()=>{let l=t/this.column>>0,n=this.fwheight;(this.flyweight.scrollTop/n>>0)+this.row-l-1>0||(this.flyweight.scrollTop=l*n,this.scroll())})}],this,{index:e})},lazyrun(e,t){clearTimeout(this.time),this.time=setTimeout(()=>{u.runer(e)},t||this.lazy)},run(e){let t=u.picker(e.target,"scrollTop=>top");u.each(this.flyweights,(l,n,i,h,s,r,c,f)=>{if(i=l/s>>0,c=i+h*(+(i<r%h)+(r/h>>0)),f=c*s+l%s,f>=this.count){this.trigger("onend");return}n.index=c,n.top=c*this.fwheight,n.data=this.flys[f]},null,this.row,this.column,t.top/this.fwheight>>0)},scroll(e){this.run(e||{target:this.flyweight})},re(){let e=this.count||this.flys.length,t=this.flyweights;if(!e)return t.length=e;let l=this.flyweight,n=u.picker(l,"clientHeight=>height,clientWidth=>width");this.$nextTick(()=>{let[i,h]=this.offset,s=n.width,r=n.height,c=(k(this.width,s)||s)+i,f=k(this.height,r)+h;this.realW=c-i,this.realH=f-h;let a=s/c>>0||1,y=r/f>>0;this.row=y+2,this.column=a,this.fwheight=f;let _=s%c/(a-1)>>0;this.Height=Math.ceil(e/a)*f;let d=Math.min(e,a*this.row),p=d-1,g,w;for(;d-- >0;)g=p-d,w=this.flys[g],l=t[g],y=g/a>>0,this.$set(t,g,{data:w,top:y*f,left:g%a*(c+_),index:y});t.length=p+1,r/f>p&&this.trigger("onend"),this.scroll()})}}},N=["data"];function S(e,t,l,n,i,h){return o.openBlock(),o.createElementBlock("div",{ref:"flyweight",class:o.normalizeClass(["flyweight",{"flyweight-active":i.actice}]),style:o.normalizeStyle({"--width":i.realW+"px","--height":i.realH+"px"}),onScroll:t[0]||(t[0]=(...s)=>h.scroll&&h.scroll(...s))},[o.createElementVNode("div",{class:"flyweight-all",style:o.normalizeStyle({"--flyweight-height":i.Height+"px"})},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.flyweights,(s,r)=>(o.openBlock(),o.createElementBlock("div",{key:r,data:s.top,style:o.normalizeStyle({top:s.top+"px",left:s.left+"px"})},[o.renderSlot(e.$slots,"default",{data:s.data,index:s.index},void 0,!0)],12,N))),128))],4),i.flyweights.length?o.renderSlot(e.$slots,"end",{key:0},void 0,!0):o.createCommentVNode("",!0)],38)}const x=v(H,[["render",S],["__scopeId","data-v-44af801a"]]),F=[x],$={install(e){F.forEach(t=>{e.component("s-"+t.name.toLowerCase(),t)})}};exports.Flyweight=x;exports.default=$;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@soei/util"),o=require("vue");const b=(e,t)=>{const l=e.__vccOpts||e;for(const[n,i]of t)l[n]=i;return l};let z=e=>e==null||e==null,T=/(\d+|[+\-\*/]|%)/g,x={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t,l)=>parseFloat(e)/100*l},_=(e,t)=>{let l;if(l=a.runer("match",e,T)){let n=l.length,i,s=0,h,r=[];for(;n--;)s=l.shift(),s in x?(i&&r.push(i),s==="%"&&(r.length=2),h=s):+s&&r.push(+s),r.length==2&&(r.push(t),i=x[h].apply(null,r),r.length=0);+i||(i=+r.pop()),e=i>>0}return e},H=(...e)=>{console.info("::::FLYWEIGHT",...e)};const N={name:"Flyweight",props:{flys:{type:Array,default:()=>[]},width:{type:Number,default:0},height:{type:Number,default:100},offset:{type:Array,default:()=>[0,0]},lazy:{type:Number,default:100},view:{type:Object,default:()=>null},index:{type:Number,default:0},top:{type:Number,default:!1},left:{type:Number,default:!1},auto:{type:[Boolean,String],default:!1}},computed:{flyweight(){return this.$refs.flyweight}},data(){return{flyweights:[],actice:!1,Height:null,column:1,row:1,fwheight:10,count:0,task:[],realW:0,realH:0}},watch:{flys(e){this.count=e.length,this.re();let t=this.task.shift();t&&this.$nextTick(()=>{this.setview(t)})},view:{handler(e){this.setview(e)},immediate:!0},index(e){this.setindex(e)},top(e){this.flyweight.scrollTop=e},left(e){this.flyweight.scrollLeft=e}},mounted(){this.flyweights=[],this.$set||(this.$set=(e,t,l)=>{e[t]=l}),this.setindex(this.index);try{new ResizeObserver(()=>{this.re(),this.$emit("resize")}).observe(this.flyweight)}catch(e){H(e)}},methods:{trigger(e){this.lazyrun(()=>this.$emit(e,!0))},cheackflys(e){if(!this.flys.length)return e&&this.task.push(e),!0},setview(e){a.runer([this.cheackflys,t=>{t=t||{};let l=t.index||a.each(this.flys,(n,i,s,h)=>{if(i[s]==h)return n},t.picker,t.id);z(l)||this.setindex(l)}],this,e)},setindex(e){a.runer([this.cheackflys,({index:t})=>{this.$nextTick(()=>{let l=t/this.column>>0,n=this.fwheight;(this.flyweight.scrollTop/n>>0)+this.row-l-1>0||(this.flyweight.scrollTop=l*n,this.scroll())})}],this,{index:e})},lazyrun(e,t){clearTimeout(this.time),this.time=setTimeout(()=>{a.runer(e)},t||this.lazy)},run(e){let t=a.picker(e.target,"scrollTop=>top");a.each(this.flyweights,(l,n,i,s,h,r,u,f)=>{if(i=l/h>>0,u=i+s*(+(i<r%s)+(r/s>>0)),f=u*h+l%h,f>=this.count){this.trigger("onend");return}n.index=u,n.top=u*this.fwheight,n.data=this.flys[f]},null,this.row,this.column,t.top/this.fwheight>>0)},scroll(e){this.run(e||{target:this.flyweight})},re(){let e=this.count||this.flys.length,t=this.flyweights;if(!e)return t.length=e;this.count=e;let l=this.flyweight,n=a.picker(l,"clientHeight=>height,clientWidth=>width");this.$nextTick(()=>{let i=this.auto===!0,[s,h]=this.offset,r=n.width,u=n.height,f=(_(this.width,r)||r)+s,g=_(this.height,u)+h;this.realW=f-s,this.realH=g-h;let c=r/f>>0||1,d=u/g>>0;this.row=d+2,this.column=c,this.fwheight=g;let m=r%f/(c-1*+!i)>>0;i&&(f=this.realW=(r/c>>0)-s,m=s),this.Height=Math.ceil(e/c)*g;let p=Math.min(e,c*this.row),w=p-1,y,k;for(;p-- >0;)y=w-p,k=this.flys[y],l=t[y],d=y/c>>0,this.$set(t,y,{data:k,top:d*g,left:y%c*(f+m),index:d});t.length=w+1,u/g>w&&this.trigger("onend"),this.scroll()})}}},S=["data"];function B(e,t,l,n,i,s){return o.openBlock(),o.createElementBlock("div",{ref:"flyweight",class:o.normalizeClass(["flyweight",{"flyweight-active":i.actice}]),style:o.normalizeStyle({"--width":i.realW+"px","--height":i.realH+"px"}),onScroll:t[0]||(t[0]=(...h)=>s.scroll&&s.scroll(...h))},[o.createElementVNode("div",{class:"flyweight-all",style:o.normalizeStyle({"--flyweight-height":i.Height+"px"})},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.flyweights,(h,r)=>(o.openBlock(),o.createElementBlock("div",{key:r,data:h.top,style:o.normalizeStyle({top:h.top+"px",left:h.left+"px"})},[o.renderSlot(e.$slots,"default",{data:h.data,index:h.index},void 0,!0)],12,S))),128))],4),i.flyweights.length?o.renderSlot(e.$slots,"end",{key:0},void 0,!0):o.createCommentVNode("",!0)],38)}const v=b(N,[["render",B],["__scopeId","data-v-144a29f8"]]),F=[v],$={install(e){F.forEach(t=>{e.component("s-"+t.name.toLowerCase(),t)})}};exports.Flyweight=v;exports.default=$;
package/dist/Flyweight.js CHANGED
@@ -1,30 +1,30 @@
1
- import { runer as g, each as _, picker as k } from "@soei/util";
2
- import { openBlock as p, createElementBlock as w, normalizeClass as H, normalizeStyle as m, createElementVNode as N, Fragment as $, renderList as F, renderSlot as v, createCommentVNode as L } from "vue";
3
- const O = (t, e) => {
1
+ import { runer as y, each as v, picker as b } from "@soei/util";
2
+ import { openBlock as w, createElementBlock as m, normalizeClass as N, normalizeStyle as x, createElementVNode as $, Fragment as F, renderList as L, renderSlot as z, createCommentVNode as O } from "vue";
3
+ const W = (t, e) => {
4
4
  const s = t.__vccOpts || t;
5
5
  for (const [n, i] of e)
6
6
  s[n] = i;
7
7
  return s;
8
8
  };
9
- let E = (t) => t == null || t == null, W = /(\d+|[+\-\*/]|%)/g, b = {
9
+ let E = (t) => t == null || t == null, S = /(\d+|[+\-\*/]|%)/g, T = {
10
10
  "+": (t, e) => t + e,
11
11
  "-": (t, e) => t - e,
12
12
  "*": (t, e) => t * e,
13
13
  "/": (t, e) => t / e,
14
14
  "%": (t, e, s) => parseFloat(t) / 100 * s
15
- }, z = (t, e) => {
15
+ }, H = (t, e) => {
16
16
  let s;
17
- if (s = g("match", t, W)) {
18
- let n = s.length, i, h = 0, l, r = [];
17
+ if (s = y("match", t, S)) {
18
+ let n = s.length, i, l = 0, h, r = [];
19
19
  for (; n--; )
20
- h = s.shift(), h in b ? (i && r.push(i), h === "%" && (r.length = 2), l = h) : +h && r.push(+h), r.length == 2 && (r.push(e), i = b[l].apply(null, r), r.length = 0);
20
+ l = s.shift(), l in T ? (i && r.push(i), l === "%" && (r.length = 2), h = l) : +l && r.push(+l), r.length == 2 && (r.push(e), i = T[h].apply(null, r), r.length = 0);
21
21
  +i || (i = +r.pop()), t = i >> 0;
22
22
  }
23
23
  return t;
24
- }, C = (...t) => {
24
+ }, B = (...t) => {
25
25
  console.info("::::FLYWEIGHT", ...t);
26
26
  };
27
- const I = {
27
+ const C = {
28
28
  name: "Flyweight",
29
29
  props: {
30
30
  flys: {
@@ -62,6 +62,10 @@ const I = {
62
62
  left: {
63
63
  type: Number,
64
64
  default: !1
65
+ },
66
+ auto: {
67
+ type: [Boolean, String],
68
+ default: !1
65
69
  }
66
70
  },
67
71
  computed: {
@@ -116,7 +120,7 @@ const I = {
116
120
  this.re(), this.$emit("resize");
117
121
  }).observe(this.flyweight);
118
122
  } catch (t) {
119
- C(t);
123
+ B(t);
120
124
  }
121
125
  },
122
126
  methods: {
@@ -128,17 +132,17 @@ const I = {
128
132
  return t && this.task.push(t), !0;
129
133
  },
130
134
  setview(t) {
131
- g([this.cheackflys, (e) => {
135
+ y([this.cheackflys, (e) => {
132
136
  e = e || {};
133
- let s = e.index || _(this.flys, (n, i, h, l) => {
134
- if (i[h] == l)
137
+ let s = e.index || v(this.flys, (n, i, l, h) => {
138
+ if (i[l] == h)
135
139
  return n;
136
140
  }, e.picker, e.id);
137
141
  E(s) || this.setindex(s);
138
142
  }], this, t);
139
143
  },
140
144
  setindex(t) {
141
- g([this.cheackflys, ({ index: e }) => {
145
+ y([this.cheackflys, ({ index: e }) => {
142
146
  this.$nextTick(() => {
143
147
  let s = e / this.column >> 0, n = this.fwheight;
144
148
  (this.flyweight.scrollTop / n >> 0) + this.row - s - 1 > 0 || (this.flyweight.scrollTop = s * n, this.scroll());
@@ -147,16 +151,16 @@ const I = {
147
151
  },
148
152
  lazyrun(t, e) {
149
153
  clearTimeout(this.time), this.time = setTimeout(() => {
150
- g(t);
154
+ y(t);
151
155
  }, e || this.lazy);
152
156
  },
153
157
  run(t) {
154
- let e = k(t.target, "scrollTop=>top");
155
- _(
158
+ let e = b(t.target, "scrollTop=>top");
159
+ v(
156
160
  this.flyweights,
157
- (s, n, i, h, l, r, f, o) => {
158
- if (i = s / l >> 0, f = i + h * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
159
- (+(i < r % h) + (r / h >> 0)), o = f * l + s % l, o >= this.count) {
161
+ (s, n, i, l, h, r, f, o) => {
162
+ if (i = s / h >> 0, f = i + l * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
163
+ (+(i < r % l) + (r / l >> 0)), o = f * h + s % h, o >= this.count) {
160
164
  this.trigger("onend");
161
165
  return;
162
166
  }
@@ -176,70 +180,71 @@ const I = {
176
180
  let t = this.count || this.flys.length, e = this.flyweights;
177
181
  if (!t)
178
182
  return e.length = t;
179
- let s = this.flyweight, n = k(s, "clientHeight=>height,clientWidth=>width");
183
+ this.count = t;
184
+ let s = this.flyweight, n = b(s, "clientHeight=>height,clientWidth=>width");
180
185
  this.$nextTick(() => {
181
- let [i, h] = this.offset, l = n.width, r = n.height, f = (z(this.width, l) || l) + i, o = z(this.height, r) + h;
182
- this.realW = f - i, this.realH = o - h;
183
- let a = l / f >> 0 || 1, u = r / o >> 0;
184
- this.row = u + 2, this.column = a, this.fwheight = o;
185
- let T = l % f / (a - 1) >> 0;
186
- this.Height = Math.ceil(t / a) * o;
187
- let y = Math.min(t, a * this.row), d = y - 1, c, x;
188
- for (; y-- > 0; )
189
- c = d - y, x = this.flys[c], s = e[c], u = c / a >> 0, this.$set(e, c, {
190
- data: x,
191
- top: u * o,
192
- left: c % a * (f + T),
193
- index: u
186
+ let i = this.auto === !0, [l, h] = this.offset, r = n.width, f = n.height, o = (H(this.width, r) || r) + l, u = H(this.height, f) + h;
187
+ this.realW = o - l, this.realH = u - h;
188
+ let a = r / o >> 0 || 1, g = f / u >> 0;
189
+ this.row = g + 2, this.column = a, this.fwheight = u;
190
+ let _ = r % o / (a - 1 * +!i) >> 0;
191
+ i && (o = this.realW = (r / a >> 0) - l, _ = l), this.Height = Math.ceil(t / a) * u;
192
+ let d = Math.min(t, a * this.row), p = d - 1, c, k;
193
+ for (; d-- > 0; )
194
+ c = p - d, k = this.flys[c], s = e[c], g = c / a >> 0, this.$set(e, c, {
195
+ data: k,
196
+ top: g * u,
197
+ left: c % a * (o + _),
198
+ index: g
194
199
  });
195
- e.length = d + 1, r / o > d && this.trigger("onend"), this.scroll();
200
+ e.length = p + 1, f / u > p && this.trigger("onend"), this.scroll();
196
201
  });
197
202
  }
198
203
  }
199
- }, S = ["data"];
200
- function A(t, e, s, n, i, h) {
201
- return p(), w("div", {
204
+ }, I = ["data"];
205
+ function A(t, e, s, n, i, l) {
206
+ return w(), m("div", {
202
207
  ref: "flyweight",
203
- class: H(["flyweight", {
208
+ class: N(["flyweight", {
204
209
  "flyweight-active": i.actice
205
210
  }]),
206
- style: m({
211
+ style: x({
207
212
  "--width": i.realW + "px",
208
213
  "--height": i.realH + "px"
209
214
  }),
210
- onScroll: e[0] || (e[0] = (...l) => h.scroll && h.scroll(...l))
215
+ onScroll: e[0] || (e[0] = (...h) => l.scroll && l.scroll(...h))
211
216
  }, [
212
- N("div", {
217
+ $("div", {
213
218
  class: "flyweight-all",
214
- style: m({
219
+ style: x({
215
220
  "--flyweight-height": i.Height + "px"
216
221
  })
217
222
  }, [
218
- (p(!0), w($, null, F(i.flyweights, (l, r) => (p(), w("div", {
223
+ (w(!0), m(F, null, L(i.flyweights, (h, r) => (w(), m("div", {
219
224
  key: r,
220
- data: l.top,
221
- style: m({
222
- top: l.top + "px",
223
- left: l.left + "px"
225
+ data: h.top,
226
+ style: x({
227
+ top: h.top + "px",
228
+ left: h.left + "px"
224
229
  })
225
230
  }, [
226
- v(t.$slots, "default", {
227
- data: l.data,
228
- index: l.index
231
+ z(t.$slots, "default", {
232
+ data: h.data,
233
+ index: h.index
229
234
  }, void 0, !0)
230
- ], 12, S))), 128))
235
+ ], 12, I))), 128))
231
236
  ], 4),
232
- i.flyweights.length ? v(t.$slots, "end", { key: 0 }, void 0, !0) : L("", !0)
237
+ i.flyweights.length ? z(t.$slots, "end", { key: 0 }, void 0, !0) : O("", !0)
233
238
  ], 38);
234
239
  }
235
- const B = /* @__PURE__ */ O(I, [["render", A], ["__scopeId", "data-v-44af801a"]]), M = [B], G = {
240
+ const M = /* @__PURE__ */ W(C, [["render", A], ["__scopeId", "data-v-144a29f8"]]), R = [M], U = {
236
241
  install(t) {
237
- M.forEach((e) => {
242
+ R.forEach((e) => {
238
243
  t.component("s-" + e.name.toLowerCase(), e);
239
244
  });
240
245
  }
241
246
  };
242
247
  export {
243
- B as Flyweight,
244
- G as default
248
+ M as Flyweight,
249
+ U as default
245
250
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .flyweight[data-v-44af801a]{height:100%;width:100%;overflow:auto;position:relative}.flyweight .flyweight-all[data-v-44af801a]{height:var(--flyweight-height)}.flyweight .flyweight-all[data-v-44af801a]>*{width:calc(var(--width));height:var(--height);position:absolute}
1
+ .flyweight[data-v-144a29f8]{height:100%;width:100%;overflow:auto;position:relative}.flyweight .flyweight-all[data-v-144a29f8]{height:var(--flyweight-height)}.flyweight .flyweight-all[data-v-144a29f8]>*{width:calc(var(--width));height:var(--height);position:absolute}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@soei/flyweight",
3
3
  "private": false,
4
4
  "description": "Vue组件, 列表de享元模式~减少DOM节点 flyweight",
5
- "version": "0.0.5",
5
+ "version": "0.0.7",
6
6
  "type": "module",
7
7
  "main": "dist/Flyweight.cjs",
8
8
  "module": "dist/Flyweight.js",
@@ -25,5 +25,7 @@
25
25
  "享元模式",
26
26
  "List",
27
27
  "列表展示"
28
- ]
28
+ ],
29
+ "author": "soei | alwbg@163.com",
30
+ "license": "ISC"
29
31
  }
package/src/Flyweight.vue CHANGED
@@ -21,7 +21,6 @@
21
21
 
22
22
  <script>
23
23
  import { each, picker, runer } from '@soei/util';
24
-
25
24
  let isNil = (data) => {
26
25
  return data == null || data == undefined;
27
26
  }
@@ -101,6 +100,10 @@ export default {
101
100
  left: {
102
101
  type: Number,
103
102
  default: false
103
+ },
104
+ auto: {
105
+ type: [Boolean, String],
106
+ default: false
104
107
  }
105
108
  },
106
109
  computed: {
@@ -242,9 +245,11 @@ export default {
242
245
  let size = this.count || this.flys.length;
243
246
  let fws = this.flyweights;
244
247
  if (!size) return fws.length = size;
248
+ this.count = size;
245
249
  let flyweight = this.flyweight;
246
250
  let wh = picker(flyweight, 'clientHeight=>height,clientWidth=>width');
247
251
  this.$nextTick(() => {
252
+ let auto = this.auto === true;
248
253
  let [x, y] = this.offset, W = wh.width, H = wh.height;
249
254
  let width = (computer(this.width, W) || W) + x;
250
255
  let height = computer(this.height, H) + y/* 偏移量填充宽度 */;
@@ -257,7 +262,11 @@ export default {
257
262
  this.fwheight = height;
258
263
  let offset = W % width;
259
264
  /* 偏移量 */
260
- let margin = offset / (column - 1) >> 0;
265
+ let margin = offset / (column - 1 * +!auto) >> 0;
266
+ if (auto) {
267
+ width = this.realW = (W / column >> 0) - x;
268
+ margin = x;
269
+ }
261
270
  /* 总高度 */
262
271
  this.Height = Math.ceil(size / column) * height;
263
272
  /* 计算数量 */