Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
vvpvvp committed Mar 1, 2019
1 parent 0f69d1d commit 6a431a5
Show file tree
Hide file tree
Showing 97 changed files with 883 additions and 882 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ module.exports = {
"error",
"unix"
],
"no-useless-call": "off"
"no-useless-call": "off",
"space-before-function-paren": ["error", { "anonymous": "always", "named": "never", "asyncArrow": "always" }]
},
parserOptions: {
parser: 'babel-eslint'
Expand Down
28 changes: 14 additions & 14 deletions src/components/affix/affix.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
default: false
}
},
data () {
data() {
return {
isFixed: false,
fixPosition: 'top',
Expand All @@ -30,7 +30,7 @@ export default {
y: 0
};
},
mounted () {
mounted() {
this.$nextTick(() => {
if (this.container) {
this.containerDom = this.container.call();
Expand All @@ -40,24 +40,24 @@ export default {
this.refresh();
});
},
beforeDestroy () {
beforeDestroy() {
window.removeEventListener('scroll', this.trigger, true);
window.removeEventListener('resize', this.trigger);
},
watch: {
offsetTop () {
offsetTop() {
this.refresh();
},
offsetBottom () {
offsetBottom() {
this.refresh();
},
fixedOffsetTop () {
fixedOffsetTop() {
this.refresh();
},
fixedOffsetBottom () {
fixedOffsetBottom() {
this.refresh();
},
disabled () {
disabled() {
if (this.disabled) {
this.isFixed = false;
this.isAbsolute = false;
Expand All @@ -67,12 +67,12 @@ export default {
}
},
methods: {
refresh () {
refresh() {
let evObj = document.createEvent('HTMLEvents');
evObj.initEvent('scroll', true, true);
document.body.dispatchEvent(evObj);
},
trigger (event) {
trigger(event) {
if (this.disabled) return;
let el = this.$el.firstChild;
if (event.target == el) return false;
Expand Down Expand Up @@ -168,19 +168,19 @@ export default {
}
},
computed: {
cFixedOffsetTop () {
cFixedOffsetTop() {
return this.fixedOffsetTop || this.offsetTop;
},
cFixedOffsetBottom () {
cFixedOffsetBottom() {
return this.fixedOffsetBottom || this.offsetBottom;
},
affixCls () {
affixCls() {
return {
[prefix]: this.isFixed,
[`${prefix}-absolute`]: this.isAbsolute
};
},
affixStyle () {
affixStyle() {
let param = {};
if (this.isFixed) {
if (this.fixPosition == 'top') {
Expand Down
72 changes: 36 additions & 36 deletions src/components/autocomplete/autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default {
default: true
}
},
data () {
data() {
return {
html: 'autocomplete_rander_html',
focusing: false,
Expand All @@ -105,20 +105,20 @@ export default {
};
},
watch: {
value () {
value() {
if (this.oldValue == this.value) {
return;
}
this.parse();
},
disabled () {
disabled() {
if (this.disabled) {
this.dropdown.disabled();
} else {
this.dropdown.enabled();
}
},
nowSelected () {
nowSelected() {
this.$nextTick(() => {
if (this.content && this.nowSelected > -1) {
let dom = this.content.querySelector('.h-autocomplete-item-selected');
Expand All @@ -138,10 +138,10 @@ export default {
});
}
},
beforeMount () {
beforeMount() {
this.parse();
},
beforeDestroy () {
beforeDestroy() {
let el = this.el;
if (el) {
el.style.display = 'none';
Expand All @@ -151,7 +151,7 @@ export default {
this.dropdown.destory();
}
},
mounted () {
mounted() {
this.$nextTick(() => {
let el = (this.el = this.$el.querySelector('.h-autocomplete-show'));
this.content = this.$el.querySelector('.h-autocomplete-group');
Expand All @@ -163,18 +163,18 @@ export default {
disabled: this.disabled,
equalWidth: true,
events: {
show () {
show() {
that.isShow = true;
}
}
});
});
},
methods: {
getKey (key) {
getKey(key) {
return key + Math.random();
},
parse () {
parse() {
this.tempValue = null;
if (this.multiple) {
let os = [];
Expand Down Expand Up @@ -226,7 +226,7 @@ export default {
}
this.oldValue = this.value;
},
getDisposeValue () {
getDisposeValue() {
let inputValue = null;
if (this.type == 'key' || this.type == 'title') {
inputValue = this.tempValue;
Expand All @@ -239,7 +239,7 @@ export default {
}
return inputValue;
},
dispose () {
dispose() {
let value = null;
let inputValue = this.getDisposeValue();
if (this.multiple) {
Expand Down Expand Up @@ -270,7 +270,7 @@ export default {
return value;
}
},
getV (object) {
getV(object) {
if (this.type == 'key') {
return object.key;
} else if (this.type == 'title') {
Expand All @@ -279,7 +279,7 @@ export default {
return object.value;
}
},
getValue (item) {
getValue(item) {
if (utils.isFunction(this.param.getValue)) {
return this.param.getValue.call(this.param, item);
} else {
Expand All @@ -292,24 +292,24 @@ export default {
}
}
},
focus (event) {
focus(event) {
this.lastTrigger = null;
this.focusing = true;
this.focusValue = event.target.value;
if (this.multiple) this.searchValue = null;
this.search();
},
focusData (value) {
focusData(value) {
this.focusValue = this.object.title;
if (this.multiple) this.searchValue = null;
},
paste (event) {
paste(event) {
setTimeout(() => {
// this.tempValue = event.target.value;
this.search();
}, 0);
},
blur (event) {
blur(event) {
this.focusing = false;
if (this.lastTrigger == 'picker' || this.lastTrigger == 'clear') return;
let nowValue = event.target.value;
Expand Down Expand Up @@ -340,7 +340,7 @@ export default {
clearTimeout(this.searchTimeout);
}
},
keydownHandle (event) {
keydownHandle(event) {
let code = event.keyCode || event.which || event.charCode;
if (code == 8 && event.target.value === '' && this.objects.length > 0) {
this.remove(this.objects[this.objects.length - 1]);
Expand All @@ -349,7 +349,7 @@ export default {
this.enterHandle(event);
}
},
handle (event) {
handle(event) {
let code = event.keyCode || event.which || event.charCode;
if (code == 38) {
if (this.nowSelected > 0) {
Expand All @@ -365,7 +365,7 @@ export default {
this.search();
}
},
enterHandle (event) {
enterHandle(event) {
let nowValue = (this.tempValue = event.target.value);
event.preventDefault();
if (this.nowSelected >= 0) {
Expand All @@ -378,7 +378,7 @@ export default {
this.setvalue('enter');
}
},
search () {
search() {
let target = this.$refs.input;
let value = target.value;
this.tempValue = value || null;
Expand Down Expand Up @@ -421,7 +421,7 @@ export default {
this.dropdown.hide();
}
},
updateDropdown () {
updateDropdown() {
this.$nextTick(() => {
if (this.dropdown) {
if (this.results.length == 0 && !this.showDropdownWhenNoResult) {
Expand All @@ -433,7 +433,7 @@ export default {
}
});
},
add (data) {
add(data) {
if (this.multiple) {
this.objects.push(utils.copy(data));
} else {
Expand All @@ -449,15 +449,15 @@ export default {
}
this.tempValue = null;
},
remove (object) {
remove(object) {
this.objects.splice(this.objects.indexOf(object), 1);
this.setvalue('remove');
},
picker (data) {
picker(data) {
this.add(data);
this.setvalue('picker');
},
setvalue (trigger) {
setvalue(trigger) {
if (this.disabled) return;
// log('setvalue', trigger)
this.lastTrigger = trigger;
Expand Down Expand Up @@ -491,11 +491,11 @@ export default {
this.searchValue = null;
}, 100);
},
hide () {
hide() {
this.loading = false;
this.dropdown.hide();
},
clear () {
clear() {
this.tempValue = null;
this.focusValue = null;
this.object = {
Expand All @@ -507,13 +507,13 @@ export default {
}
},
computed: {
showPlaceholder () {
showPlaceholder() {
return this.placeholder || this.t('h.autoComplate.placeholder');
},
showEmptyContent () {
showEmptyContent() {
return this.emptyContent || this.t('h.autoComplate.emptyContent');
},
param () {
param() {
if (this.config) {
return utils.extend({},
config.getOption('autocomplete.default'),
Expand All @@ -527,7 +527,7 @@ export default {
);
}
},
autocompleteCls () {
autocompleteCls() {
let autosize = !!this.noBorder;
if (!autosize) {
autosize = this.autosize;
Expand All @@ -541,21 +541,21 @@ export default {
focusing: this.focusing
};
},
showCls () {
showCls() {
return {
[`${prefix}-show`]: true,
[`${this.className}-show`]: !!this.className,
focusing: this.focusing
};
},
groupCls () {
groupCls() {
return {
[`${prefix}-group`]: true,
[`${prefix}-multiple`]: this.multiple,
[`${this.className}-dropdown`]: !!this.className
};
},
results () {
results() {
let datas = this.datas;
if (this.dict) {
datas = config.getDict(this.dict);
Expand Down
Loading

0 comments on commit 6a431a5

Please sign in to comment.