Skip to content

Commit fa75b0e

Browse files
committed
indent fix
1 parent de7afec commit fa75b0e

File tree

4 files changed

+206
-156
lines changed

4 files changed

+206
-156
lines changed

.eslintrc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ module.exports = {
1212
'no-shadow': 0,
1313
'no-mixed-operators': 0,
1414
'no-plusplus': 0,
15+
'no-unused-expressions': ['error', {allowShortCircuit: true}],
16+
'no-underscore-dangle': ['error',
17+
{
18+
allow: [
19+
'_cbs',
20+
'_children',
21+
'_queues',
22+
'_$lazy',
23+
'_lazyBound'
24+
]
25+
}
26+
],
27+
'no-multi-assign': 0,
28+
'no-param-reassign': 0,
1529
'no-var': 0,
1630
'linebreak-style': 0,
1731
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],

src/index.js

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
import {$} from './util';
2-
import {LazyClass} from './lazy';
1+
/**
2+
* @preserve
3+
* vue-l-lazyload
4+
*
5+
* Copyright (c) 2017 - NOW Light Leung
6+
*
7+
* This library is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10+
* Lesser General Public License for more details.
11+
*/
12+
import { $ } from './util';
13+
import { LazyClass } from './lazy';
314

415
var LazyLoader;
516

@@ -15,14 +26,14 @@ const LazyRef = {
1526
props: {
1627
tag: {
1728
type: String,
18-
default: 'div'
29+
default: 'div',
1930
},
2031
opts: {
2132
type: Object,
2233
default() {
2334
return {};
24-
}
25-
}
35+
},
36+
},
2637
},
2738
render(createElement) {
2839
const me = this;
@@ -34,7 +45,7 @@ const LazyRef = {
3445

3546
vm.$lazy = new LazyLoader({
3647
...vm.opts,
37-
el: el
48+
el,
3849
});
3950
},
4051
methods: {
@@ -49,8 +60,8 @@ const LazyRef = {
4960
},
5061
rm(lazyLoader) {
5162
this.$lazy.rmChild(lazyLoader);
52-
}
53-
}
63+
},
64+
},
5465
};
5566

5667
const Lazy = {
@@ -59,7 +70,7 @@ const Lazy = {
5970

6071
if (isStr(opts)) {
6172
opts = {
62-
src: opts
73+
src: opts,
6374
};
6475
}
6576

@@ -71,9 +82,9 @@ const Lazy = {
7182

7283
// add to after $refs has references
7384
vm.$nextTick(() => {
85+
var ref;
7486
// Prevent it's unbound before initialization
7587
if (el._lazyBound) {
76-
var ref;
7788
if (refStr) {
7889
ref = vm.$refs[refStr];
7990
if (!ref) {
@@ -83,7 +94,7 @@ const Lazy = {
8394

8495
const mergedOpts = {
8596
...opts,
86-
el: el
97+
el,
8798
},
8899
$lazy = ref && ref.$lazy;
89100

@@ -108,12 +119,12 @@ const Lazy = {
108119

109120
if (loader) {
110121
loader.update({
111-
src: nSrc
122+
src: nSrc,
112123
});
113124
}
114125
}
115126
},
116-
unbind(el, binding, vnode){
127+
unbind(el, binding, vnode) {
117128
if (el._lazyBound) {
118129
el._lazyBound = false;
119130
}
@@ -125,25 +136,25 @@ const Lazy = {
125136
el._$lazy = null;
126137
}
127138
});
128-
}
139+
},
129140
};
130141

131142
const VueLLazyload = {
132143
install(Vue, options = {}) {
133144
LazyLoader = LazyClass(Vue);
134145
Vue.$lazy = new LazyLoader({
135146
...options,
136-
isRoot: true
147+
isRoot: true,
137148
});
138149

139150
Vue.directive('lazy', Lazy);
140151

141152
Vue.component('lazy-ref', LazyRef);
142-
}
153+
},
143154
};
144155

145156
export {
146157
LazyRef,
147158
Lazy,
148-
VueLLazyload
159+
VueLLazyload,
149160
};

0 commit comments

Comments
 (0)