🎨 add eslint

This commit is contained in:
jingsam 2016-12-25 22:49:42 +08:00
parent 829a2e4cfc
commit b0893113b3
88 changed files with 376 additions and 370 deletions

View file

@ -29,7 +29,7 @@
renderType: '',
uid: -1,
content: this.$parent.$parent.content
}
};
},
computed: {
classes () {
@ -38,7 +38,7 @@
{
[`${this.prefixCls}-hidden`]: !this.fixed && this.column.fixed && (this.column.fixed === 'left' || this.column.fixed === 'right')
}
]
];
}
},
methods: {
@ -94,5 +94,5 @@
this.compile();
}
}
}
</script>
};
</script>

View file

@ -3,11 +3,11 @@ function has (browser) {
if (browser === 'ie') {
const isIE = ua.indexOf('compatible') > -1 && ua.indexOf('MSIE') > -1;
if (isIE) {
const reIE = new RegExp("MSIE (\\d+\\.\\d+);");
const reIE = new RegExp('MSIE (\\d+\\.\\d+);');
reIE.test(ua);
return parseFloat(RegExp["$1"]);
return parseFloat(RegExp['$1']);
} else {
return false
return false;
}
} else {
return ua.indexOf(browser) > -1;
@ -19,12 +19,12 @@ const csv = {
let iev = 0;
const ieold = (/MSIE (\d+\.\d+);/.test(navigator.userAgent));
const trident = !!navigator.userAgent.match(/Trident\/7.0/);
const rv = navigator.userAgent.indexOf("rv:11.0");
const rv = navigator.userAgent.indexOf('rv:11.0');
if (ieold) {
iev = Number(RegExp.$1);
}
if (navigator.appVersion.indexOf("MSIE 10") !== -1) {
if (navigator.appVersion.indexOf('MSIE 10') !== -1) {
iev = 10;
}
if (trident && rv !== -1) {
@ -39,7 +39,7 @@ const csv = {
},
_getDownloadUrl (text) {
const BOM = "\uFEFF";
const BOM = '\uFEFF';
// Add BOM to text for open in excel correctly
if (window.Blob && window.URL && window.URL.createObjectURL && !has('Safari')) {
const csvData = new Blob([BOM + text], { type: 'text/csv' });
@ -52,14 +52,14 @@ const csv = {
download (filename, text) {
if (has('ie') && has('ie') < 10) {
// has module unable identify ie11 and Edge
const oWin = window.top.open("about:blank", "_blank");
const oWin = window.top.open('about:blank', '_blank');
oWin.document.charset = 'utf-8';
oWin.document.write(text);
oWin.document.close();
oWin.document.execCommand('SaveAs', filename);
oWin.close();
} else if (has("ie") === 10 || this._isIE11() || this._isEdge()) {
const BOM = "\uFEFF";
} else if (has('ie') === 10 || this._isIE11() || this._isEdge()) {
const BOM = '\uFEFF';
const csvData = new Blob([BOM + text], { type: 'text/csv' });
navigator.msSaveBlob(csvData, filename);
} else {

View file

@ -6,21 +6,21 @@ export default {
[`${this.prefixCls}-column-${column.align}`]: column.align,
[`${this.prefixCls}-hidden`]: (this.fixed === 'left' && column.fixed !== 'left') || (this.fixed === 'right' && column.fixed !== 'right') || (!this.fixed && column.fixed && (column.fixed === 'left' || column.fixed === 'right'))
}
]
];
},
isPopperShow (column) {
return column.filters && ((!this.fixed && !column.fixed) || (this.fixed === 'left' && column.fixed === 'left') || (this.fixed === 'right' && column.fixed === 'right'));
},
setCellWidth (column, index) {
setCellWidth (column) {
// return column.width ? column.width : this.columnsWidth[index];
let width = '';
if (column.width) {
width = column.width;
} else if (this.columnsWidth[column._index]) {
width = this.columnsWidth[column._index].width
width = this.columnsWidth[column._index].width;
}
// return this.columnsWidth[column._index] ? this.columnsWidth[column._index].width : '';
return width;
}
}
}
};

View file

@ -52,7 +52,7 @@
[`${this.prefixCls}-row-highlight`]: this.objData[_index] && this.objData[_index]._isHighlight,
[`${this.prefixCls}-row-hover`]: this.objData[_index] && this.objData[_index]._isHover
}
]
];
},
rowChecked (_index) {
return this.objData[_index] && this.objData[_index]._isChecked;
@ -70,5 +70,5 @@
this.$parent.highlightCurrentRow(_index);
}
}
}
</script>
};
</script>

View file

@ -58,7 +58,6 @@
import Poptip from '../poptip/poptip.vue';
import iButton from '../button/button.vue';
import Mixin from './mixin';
import { deepCopy } from '../../utils/assist';
export default {
mixins: [ Mixin ],
@ -97,7 +96,7 @@
{
[`${this.prefixCls}-hidden`]: !this.fixed && column.fixed && (column.fixed === 'left' || column.fixed === 'right')
}
]
];
},
itemClasses (column, item) {
return [
@ -105,7 +104,7 @@
{
[`${this.prefixCls}-filter-select-item-selected`]: column._filterChecked[0] === item.value
}
]
];
},
itemAllClasses (column) {
return [
@ -113,7 +112,7 @@
{
[`${this.prefixCls}-filter-select-item-selected`]: !column._filterChecked.length
}
]
];
},
renderHeader (column, $index) {
if ('renderHeader' in this.columns[$index]) {
@ -145,5 +144,5 @@
this.$parent.handleFilterHide(index);
}
}
}
</script>
};
</script>

View file

@ -83,13 +83,13 @@
data: {
type: Array,
default () {
return []
return [];
}
},
columns: {
type: Array,
default () {
return []
return [];
}
},
size: {
@ -142,7 +142,7 @@
showSlotHeader: true,
showSlotFooter: true,
bodyHeight: 0
}
};
},
computed: {
wrapClasses () {
@ -153,7 +153,7 @@
[`${prefixCls}-with-header`]: this.showSlotHeader,
[`${prefixCls}-with-footer`]: this.showSlotFooter
}
]
];
},
classes () {
return [
@ -164,12 +164,12 @@
[`${prefixCls}-stripe`]: this.stripe,
[`${prefixCls}-with-fixed-top`]: !!this.height
}
]
];
},
styles () {
let style = {};
if (!!this.height) style.height = `${this.height}px`;
if (!!this.width) style.width = `${this.width}px`;
if (this.height) style.height = `${this.height}px`;
if (this.width) style.width = `${this.width}px`;
return style;
},
tableStyle () {
@ -269,7 +269,7 @@
columnsWidth[column._index] = {
width: width
}
};
}
this.columnsWidth = columnsWidth;
}
@ -334,13 +334,13 @@
this.$emit('on-selection-change', selection);
},
fixedHeader () {
if (!!this.height) {
if (this.height) {
this.$nextTick(() => {
const titleHeight = parseInt(getStyle(this.$els.title, 'height')) || 0;
const headerHeight = parseInt(getStyle(this.$els.header, 'height')) || 0;
const footerHeight = parseInt(getStyle(this.$els.footer, 'height')) || 0;
this.bodyHeight = this.height - titleHeight - headerHeight - footerHeight;
})
});
} else {
this.bodyHeight = 0;
}
@ -584,5 +584,5 @@
this.fixedHeader();
}
}
}
</script>
};
</script>