🎨 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

18
.eslintrc.json Normal file
View file

@ -0,0 +1,18 @@
{
"root": true,
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"browser": true
},
"extends": "eslint:recommended",
"plugins": [ "html" ],
"rules": {
"indent": ["error", 4, { "SwitchCase": 1 }],
"quotes": ["error", "single"],
"semi": ["error", "always"],
"no-console": ["off"]
}
}

View file

@ -1,8 +1,5 @@
sudo: false
language: node_js language: node_js
node_js: node_js:
- "5" - "4"
script:
script: make dist - npm run test

View file

@ -6,20 +6,20 @@ var autoprefixer = require('gulp-autoprefixer');
// 编译less // 编译less
gulp.task('css', function () { gulp.task('css', function () {
gulp.src('../src/styles/index.less') gulp.src('../src/styles/index.less')
.pipe(less()) .pipe(less())
.pipe(autoprefixer({ .pipe(autoprefixer({
browsers: ['last 2 versions', 'ie > 8'] browsers: ['last 2 versions', 'ie > 8']
})) }))
.pipe(cleanCSS()) .pipe(cleanCSS())
.pipe(rename('iview.css')) .pipe(rename('iview.css'))
.pipe(gulp.dest('../dist/styles')) .pipe(gulp.dest('../dist/styles'));
}); });
// 拷贝字体文件 // 拷贝字体文件
gulp.task('fonts', function () { gulp.task('fonts', function () {
gulp.src('../src/styles/common/iconfont/fonts/*.*') gulp.src('../src/styles/common/iconfont/fonts/*.*')
.pipe(gulp.dest('../dist/styles/fonts')) .pipe(gulp.dest('../dist/styles/fonts'));
}); });
gulp.task('default', ['css', 'fonts']); gulp.task('default', ['css', 'fonts']);

View file

@ -24,6 +24,8 @@
"dist:dev": "webpack --config build/webpack.dist.dev.config.js", "dist:dev": "webpack --config build/webpack.dist.dev.config.js",
"dist:prod": "webpack --config build/webpack.dist.prod.config.js", "dist:prod": "webpack --config build/webpack.dist.prod.config.js",
"dist": "npm run dist:style && npm run dist:dev && npm run dist:prod", "dist": "npm run dist:style && npm run dist:dev && npm run dist:prod",
"lint": "eslint --fix --ext .js,.vue src",
"test": "npm run dist && npm run lint",
"prepublish": "npm run dist" "prepublish": "npm run dist"
}, },
"repository": { "repository": {
@ -51,9 +53,8 @@
"babel-preset-es2015": "^6.9.0", "babel-preset-es2015": "^6.9.0",
"babel-runtime": "^6.11.6", "babel-runtime": "^6.11.6",
"css-loader": "^0.23.1", "css-loader": "^0.23.1",
"eslint": "^2.5.3", "eslint": "^3.12.2",
"eslint-friendly-formatter": "^2.0.6", "eslint-plugin-html": "^1.7.0",
"eslint-loader": "^1.3.0",
"extract-text-webpack-plugin": "^1.0.1", "extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.8.5", "file-loader": "^0.8.5",
"gulp": "^3.9.1", "gulp": "^3.9.1",

View file

@ -35,7 +35,7 @@
return { return {
top: rect.top + scrollTop - clientTop, top: rect.top + scrollTop - clientTop,
left: rect.left + scrollLeft - clientLeft left: rect.left + scrollLeft - clientLeft
} };
} }
export default { export default {
@ -52,7 +52,7 @@
return { return {
affix: false, affix: false,
styles: {} styles: {}
} };
}, },
computed: { computed: {
offsetType () { offsetType () {
@ -68,7 +68,7 @@
{ {
[`${prefixCls}`]: this.affix [`${prefixCls}`]: this.affix
} }
] ];
} }
}, },
ready () { ready () {
@ -122,5 +122,5 @@
} }
} }
} }
} };
</script> </script>

View file

@ -42,7 +42,7 @@
return { return {
closed: false, closed: false,
desc: false desc: false
} };
}, },
computed: { computed: {
wrapClasses () { wrapClasses () {
@ -53,7 +53,7 @@
[`${prefixCls}-with-icon`]: this.showIcon, [`${prefixCls}-with-icon`]: this.showIcon,
[`${prefixCls}-with-desc`]: this.desc [`${prefixCls}-with-desc`]: this.desc
} }
] ];
}, },
messageClasses () { messageClasses () {
return `${prefixCls}-message`; return `${prefixCls}-message`;
@ -97,5 +97,5 @@
compiled () { compiled () {
this.desc = this.$els.desc.innerHTML != ''; this.desc = this.$els.desc.innerHTML != '';
} }
} };
</script> </script>

View file

@ -28,7 +28,7 @@
data () { data () {
return { return {
backTop: false backTop: false
} };
}, },
ready () { ready () {
window.addEventListener('scroll', this.handleScroll, false); window.addEventListener('scroll', this.handleScroll, false);
@ -45,13 +45,13 @@
{ {
[`${prefixCls}-show`]: this.backTop [`${prefixCls}-show`]: this.backTop
} }
] ];
}, },
styles () { styles () {
return { return {
bottom: `${this.bottom}px`, bottom: `${this.bottom}px`,
right: `${this.right}px` right: `${this.right}px`
} };
}, },
innerClasses () { innerClasses () {
return `${prefixCls}-inner`; return `${prefixCls}-inner`;
@ -66,5 +66,5 @@
this.$emit('on-click'); this.$emit('on-click');
} }
} }
} };
</script> </script>

View file

@ -38,7 +38,7 @@
[`${this.class}`]: !!this.class, [`${this.class}`]: !!this.class,
[`${prefixCls}-count-alone`]: this.alone [`${prefixCls}-count-alone`]: this.alone
} }
] ];
}, },
finalCount () { finalCount () {
return parseInt(this.count) >= parseInt(this.overflowCount) ? `${this.overflowCount}+` : this.count; return parseInt(this.count) >= parseInt(this.overflowCount) ? `${this.overflowCount}+` : this.count;
@ -65,7 +65,7 @@
data () { data () {
return { return {
alone: false alone: false
} };
}, },
compiled () { compiled () {
const child_length = this.$els.badge.children.length; const child_length = this.$els.badge.children.length;
@ -73,5 +73,5 @@
this.alone = true; this.alone = true;
} }
} }
} };
</script> </script>

View file

@ -31,7 +31,7 @@ Notification.newInstance = properties => {
destroy () { destroy () {
document.body.removeChild(div); document.body.removeChild(div);
} }
} };
}; };
export default Notification; export default Notification;

View file

@ -26,7 +26,7 @@
default: function() { default: function() {
return { return {
right: '50%' right: '50%'
} };
} }
}, },
closable: { closable: {
@ -50,7 +50,7 @@
data () { data () {
return { return {
withDesc: false withDesc: false
} };
}, },
computed: { computed: {
baseClass () { baseClass () {
@ -64,7 +64,7 @@
[`${this.baseClass}-closable`]: this.closable, [`${this.baseClass}-closable`]: this.closable,
[`${this.baseClass}-with-desc`]: this.withDesc [`${this.baseClass}-with-desc`]: this.withDesc
} }
] ];
}, },
contentClasses () { contentClasses () {
return `${this.baseClass}-content`; return `${this.baseClass}-content`;
@ -89,7 +89,7 @@
if (this.duration !== 0) { if (this.duration !== 0) {
this.closeTimer = setTimeout(() => { this.closeTimer = setTimeout(() => {
this.close(); this.close();
}, this.duration * 1000) }, this.duration * 1000);
} }
// check if with desc in Notice component // check if with desc in Notice component
@ -100,5 +100,5 @@
beforeDestroy () { beforeDestroy () {
this.clearCloseTimer(); this.clearCloseTimer();
} }
} };
</script> </script>

View file

@ -36,7 +36,7 @@
return { return {
top: '65px', top: '65px',
left: '50%' left: '50%'
} };
} }
}, },
content: { content: {
@ -49,7 +49,7 @@
data () { data () {
return { return {
notices: [] notices: []
} };
}, },
computed: { computed: {
classes () { classes () {
@ -58,7 +58,7 @@
{ {
[`${this.className}`]: !!this.className [`${this.className}`]: !!this.className
} }
] ];
} }
}, },
methods: { methods: {
@ -88,5 +88,5 @@
} }
} }
} }
} };
</script> </script>

View file

@ -26,7 +26,7 @@ export default {
return { return {
gpuAcceleration: false, gpuAcceleration: false,
boundariesElement: 'body' boundariesElement: 'body'
} };
} }
}, },
visible: { visible: {

View file

@ -32,5 +32,5 @@
return `${prefixCls}-separator`; return `${prefixCls}-separator`;
} }
} }
} };
</script> </script>

View file

@ -33,5 +33,5 @@
this.updateChildren(); this.updateChildren();
} }
} }
} };
</script> </script>

View file

@ -34,8 +34,8 @@
[`${prefixCls}-${this.shape}`]: !!this.shape, [`${prefixCls}-${this.shape}`]: !!this.shape,
[`${prefixCls}-vertical`]: this.vertical [`${prefixCls}-vertical`]: this.vertical
} }
] ];
} }
} }
} };
</script> </script>

View file

@ -46,7 +46,7 @@
data () { data () {
return { return {
showSlot: true showSlot: true
} };
}, },
computed: { computed: {
classes () { classes () {
@ -60,11 +60,11 @@
[`${prefixCls}-loading`]: this.loading != null && this.loading, [`${prefixCls}-loading`]: this.loading != null && this.loading,
[`${prefixCls}-icon-only`]: !this.showSlot && (!!this.icon || this.loading) [`${prefixCls}-icon-only`]: !this.showSlot && (!!this.icon || this.loading)
} }
] ];
} }
}, },
compiled () { compiled () {
this.showSlot = this.$els.slot.innerHTML.replace(/\n/g, '').replace(/<!--[\w\W\r\n]*?-->/gmi, '') !== ''; this.showSlot = this.$els.slot.innerHTML.replace(/\n/g, '').replace(/<!--[\w\W\r\n]*?-->/gmi, '') !== '';
} }
} };
</script> </script>

View file

@ -27,7 +27,7 @@
return { return {
showHead: true, showHead: true,
showExtra: true showExtra: true
} };
}, },
computed: { computed: {
classes () { classes () {
@ -38,7 +38,7 @@
[`${prefixCls}-dis-hover`]: this.disHover || this.shadow, [`${prefixCls}-dis-hover`]: this.disHover || this.shadow,
[`${prefixCls}-shadow`]: this.shadow [`${prefixCls}-shadow`]: this.shadow
} }
] ];
}, },
headClasses () { headClasses () {
return `${prefixCls}-head`; return `${prefixCls}-head`;
@ -54,5 +54,5 @@
this.showHead = this.$els.head.innerHTML != ''; this.showHead = this.$els.head.innerHTML != '';
this.showExtra = this.$els.extra.innerHTML != ''; this.showExtra = this.$els.extra.innerHTML != '';
} }
} };
</script> </script>

View file

@ -39,13 +39,13 @@
data: { data: {
type: Array, type: Array,
default () { default () {
return [] return [];
} }
}, },
value: { value: {
type: Array, type: Array,
default () { default () {
return [] return [];
} }
}, },
disabled: { disabled: {
@ -88,7 +88,7 @@
visible: false, visible: false,
selected: [], selected: [],
tmpSelected: [] tmpSelected: []
} };
}, },
computed: { computed: {
classes () { classes () {
@ -99,7 +99,7 @@
[`${prefixCls}-visible`]: this.visible, [`${prefixCls}-visible`]: this.visible,
[`${prefixCls}-disabled`]: this.disabled [`${prefixCls}-disabled`]: this.disabled
} }
] ];
}, },
showCloseIcon () { showCloseIcon () {
return this.value && this.value.length && this.clearable; return this.value && this.value.length && this.clearable;
@ -182,5 +182,5 @@
this.updateSelected(); this.updateSelected();
} }
} }
} };
</script> </script>

View file

@ -16,8 +16,8 @@
[`${this.prefixCls}-menu-item-active`]: this.tmpItem.value === this.data.value, [`${this.prefixCls}-menu-item-active`]: this.tmpItem.value === this.data.value,
[`${this.prefixCls}-menu-item-disabled`]: this.data.disabled [`${this.prefixCls}-menu-item-disabled`]: this.data.disabled
} }
] ];
} }
} }
} };
</script> </script>

View file

@ -11,7 +11,6 @@
</template> </template>
<script> <script>
import Casitem from './casitem.vue'; import Casitem from './casitem.vue';
import { oneOf } from '../../utils/assist';
export default { export default {
name: 'Caspanel', name: 'Caspanel',
@ -20,13 +19,13 @@
data: { data: {
type: Array, type: Array,
default () { default () {
return [] return [];
} }
}, },
sublist: { sublist: {
type: Array, type: Array,
default () { default () {
return [] return [];
} }
}, },
disabled: Boolean, disabled: Boolean,
@ -38,7 +37,7 @@
return { return {
tmpItem: {}, tmpItem: {},
result: [] result: []
} };
}, },
methods: { methods: {
handleClickItem (item) { handleClickItem (item) {
@ -111,5 +110,5 @@
this.tmpItem = {}; this.tmpItem = {};
} }
} }
} };
</script> </script>

View file

@ -12,7 +12,7 @@
model: { model: {
type: Array, type: Array,
default () { default () {
return [] return [];
} }
} }
}, },
@ -43,14 +43,9 @@
} }
}, },
watch: { watch: {
model (val, oldVal) { model () {
// if (val == oldVal) {
// this.updateModel();
// } else {
// this.updateModel(true);
// }
this.updateModel(true); this.updateModel(true);
} }
} }
} };
</script> </script>

View file

@ -44,7 +44,7 @@
selected: false, selected: false,
group: false, group: false,
showSlot: true showSlot: true
} };
}, },
computed: { computed: {
wrapClasses () { wrapClasses () {
@ -55,7 +55,7 @@
[`${prefixCls}-wrapper-checked`]: this.selected, [`${prefixCls}-wrapper-checked`]: this.selected,
[`${prefixCls}-wrapper-disabled`]: this.disabled [`${prefixCls}-wrapper-disabled`]: this.disabled
} }
] ];
}, },
checkboxClasses () { checkboxClasses () {
return [ return [
@ -64,7 +64,7 @@
[`${prefixCls}-checked`]: this.selected, [`${prefixCls}-checked`]: this.selected,
[`${prefixCls}-disabled`]: this.disabled [`${prefixCls}-disabled`]: this.disabled
} }
] ];
}, },
innerClasses () { innerClasses () {
return `${prefixCls}-inner`; return `${prefixCls}-inner`;
@ -105,5 +105,5 @@
this.updateModel(); this.updateModel();
} }
} }
} };
</script> </script>

View file

@ -70,7 +70,7 @@
'stroke-dasharray': `${this.len}px ${this.len}px`, 'stroke-dasharray': `${this.len}px ${this.len}px`,
'stroke-dashoffset': `${((100 - this.percent) / 100 * this.len)}px`, 'stroke-dashoffset': `${((100 - this.percent) / 100 * this.len)}px`,
'transition': 'stroke-dashoffset 0.6s ease 0s, stroke 0.6s ease' 'transition': 'stroke-dashoffset 0.6s ease 0s, stroke 0.6s ease'
} };
}, },
wrapClasses () { wrapClasses () {
return `${prefixCls}`; return `${prefixCls}`;
@ -79,5 +79,5 @@
return `${prefixCls}-inner`; return `${prefixCls}-inner`;
} }
} }
} };
</script> </script>

View file

@ -40,7 +40,7 @@
child.isActive = isActive; child.isActive = isActive;
child.index = index; child.index = index;
}) });
}, },
getActiveKey () { getActiveKey () {
let activeKey = this.activeKey || []; let activeKey = this.activeKey || [];
@ -94,5 +94,5 @@
this.setActive(); this.setActive();
} }
} }
} };
</script> </script>

View file

@ -24,7 +24,7 @@
return { return {
index: 0, // use index for default when key is null index: 0, // use index for default when key is null
isActive: false isActive: false
} };
}, },
computed: { computed: {
itemClasses () { itemClasses () {
@ -33,7 +33,7 @@
{ {
[`${prefixCls}-item-active`]: this.isActive [`${prefixCls}-item-active`]: this.isActive
} }
] ];
}, },
headerClasses () { headerClasses () {
return `${prefixCls}-header`; return `${prefixCls}-header`;
@ -53,5 +53,5 @@
}); });
} }
} }
} };
</script> </script>

View file

@ -14,7 +14,7 @@
data () { data () {
return { return {
prefixCls: prefixCls prefixCls: prefixCls
} };
}, },
methods: { methods: {
handleClear () { handleClear () {
@ -24,5 +24,5 @@
this.$emit('on-pick-success'); this.$emit('on-pick-success');
} }
} }
} };
</script> </script>

View file

@ -10,7 +10,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getFirstDayOfMonth, getDayCountOfMonth, getStartDateOfMonth } from '../util'; import { getFirstDayOfMonth, getDayCountOfMonth } from '../util';
import { deepCopy } from '../../../utils/assist'; import { deepCopy } from '../../../utils/assist';
const prefixCls = 'ivu-date-picker-cells'; const prefixCls = 'ivu-date-picker-cells';
@ -46,7 +46,7 @@
return { return {
prefixCls: prefixCls, prefixCls: prefixCls,
readCells: [] readCells: []
} };
}, },
watch: { watch: {
'rangeState.endDate' (newVal) { 'rangeState.endDate' (newVal) {
@ -84,7 +84,7 @@
classes () { classes () {
return [ return [
`${prefixCls}` `${prefixCls}`
] ];
}, },
cells () { cells () {
const date = new Date(this.year, this.month, 1); const date = new Date(this.year, this.month, 1);
@ -269,9 +269,9 @@
[`${prefixCls}-cell-next-month`]: cell.type === 'next-month', [`${prefixCls}-cell-next-month`]: cell.type === 'next-month',
[`${prefixCls}-cell-range`]: cell.range && !cell.start && !cell.end [`${prefixCls}-cell-range`]: cell.range && !cell.start && !cell.end
} }
] ];
}, },
} }
} };
</script> </script>

View file

@ -23,7 +23,7 @@
return [ return [
`${prefixCls}`, `${prefixCls}`,
`${prefixCls}-month` `${prefixCls}-month`
] ];
}, },
cells () { cells () {
let cells = []; let cells = [];
@ -56,7 +56,7 @@
[`${prefixCls}-cell-selected`]: cell.selected, [`${prefixCls}-cell-selected`]: cell.selected,
[`${prefixCls}-cell-disabled`]: cell.disabled [`${prefixCls}-cell-disabled`]: cell.disabled
} }
] ];
}, },
handleClick (event) { handleClick (event) {
const target = event.target; const target = event.target;
@ -70,5 +70,5 @@
this.$emit('on-pick-click'); this.$emit('on-pick-click');
} }
} }
} };
</script> </script>

View file

@ -21,7 +21,7 @@
return [ return [
`${prefixCls}`, `${prefixCls}`,
`${prefixCls}-year` `${prefixCls}-year`
] ];
}, },
startYear() { startYear() {
return Math.floor(this.year / 10) * 10; return Math.floor(this.year / 10) * 10;
@ -57,7 +57,7 @@
[`${prefixCls}-cell-selected`]: cell.selected, [`${prefixCls}-cell-selected`]: cell.selected,
[`${prefixCls}-cell-disabled`]: cell.disabled [`${prefixCls}-cell-disabled`]: cell.disabled
} }
] ];
}, },
nextTenYear() { nextTenYear() {
this.$emit('on-pick', Number(this.year) + 10, false); this.$emit('on-pick', Number(this.year) + 10, false);
@ -76,5 +76,5 @@
this.$emit('on-pick-click'); this.$emit('on-pick-click');
} }
} }
} };
</script> </script>

View file

@ -157,7 +157,7 @@
selectionMode: 'range', selectionMode: 'range',
leftTableYear: null, leftTableYear: null,
rightTableYear: null rightTableYear: null
} };
}, },
computed: { computed: {
classes () { classes () {
@ -167,7 +167,7 @@
{ {
[`${prefixCls}-with-sidebar`]: this.shortcuts.length [`${prefixCls}-with-sidebar`]: this.shortcuts.length
} }
] ];
}, },
leftYear () { leftYear () {
return this.date.getFullYear(); return this.date.getFullYear();
@ -353,5 +353,5 @@
this.rangeState = val.rangeState; this.rangeState = val.rangeState;
} }
} }
} };
</script> </script>

View file

@ -73,7 +73,6 @@
import YearTable from '../base/year-table.vue'; import YearTable from '../base/year-table.vue';
import MonthTable from '../base/month-table.vue'; import MonthTable from '../base/month-table.vue';
import Confirm from '../base/confirm.vue'; import Confirm from '../base/confirm.vue';
import { formatDate, parseDate } from '../util';
import Mixin from './mixin'; import Mixin from './mixin';
@ -97,7 +96,7 @@
year: null, year: null,
month: null, month: null,
confirm: false confirm: false
} };
}, },
computed: { computed: {
classes () { classes () {
@ -106,7 +105,7 @@
{ {
[`${prefixCls}-with-sidebar`]: this.shortcuts.length [`${prefixCls}-with-sidebar`]: this.shortcuts.length
} }
] ];
}, },
yearLabel () { yearLabel () {
const year = this.year; const year = this.year;
@ -238,5 +237,5 @@
this.month = this.date.getMonth(); this.month = this.date.getMonth();
} }
} }
} };
</script> </script>

View file

@ -8,7 +8,7 @@ export default {
`${prefixCls}-icon-btn`, `${prefixCls}-icon-btn`,
`${datePrefixCls}-${direction}-btn`, `${datePrefixCls}-${direction}-btn`,
`${datePrefixCls}-${direction}-btn-arrow${type}`, `${datePrefixCls}-${direction}-btn-arrow${type}`,
] ];
}, },
handleShortcutClick (shortcut) { handleShortcutClick (shortcut) {
if (shortcut.value) this.$emit('on-pick', shortcut.value()); if (shortcut.value) this.$emit('on-pick', shortcut.value());
@ -24,4 +24,4 @@ export default {
this.$emit('on-pick-click'); this.$emit('on-pick-click');
} }
} }
} };

View file

@ -193,7 +193,7 @@
picker: null, picker: null,
internalValue: '', internalValue: '',
disableClickOutSide: false // fixed when click a date,trigger clickoutside to close picker disableClickOutSide: false // fixed when click a date,trigger clickoutside to close picker
} };
}, },
computed: { computed: {
opened () { opened () {
@ -424,5 +424,5 @@
ready () { ready () {
if (this.open !== null) this.visible = this.open; if (this.open !== null) this.visible = this.open;
} }
} };
</script> </script>

View file

@ -33,4 +33,4 @@ export default {
this.panel = getPanel(this.type); this.panel = getPanel(this.type);
} }
} };

View file

@ -31,7 +31,7 @@
[`${prefixCls}-selected`]: this.selected, [`${prefixCls}-selected`]: this.selected,
[`${prefixCls}-divided`]: this.divided [`${prefixCls}-divided`]: this.divided
} }
] ];
} }
}, },
methods: { methods: {
@ -53,5 +53,5 @@
$parent.$emit('on-click', this.key); $parent.$emit('on-click', this.key);
} }
} }
} };
</script> </script>

View file

@ -2,5 +2,5 @@
<ul class="ivu-dropdown-menu"><slot></slot></ul> <ul class="ivu-dropdown-menu"><slot></slot></ul>
</template> </template>
<script> <script>
export default {} export default {};
</script> </script>

View file

@ -42,7 +42,7 @@
return { return {
prefixCls: prefixCls, prefixCls: prefixCls,
visible: false visible: false
} };
}, },
methods: { methods: {
handleClick () { handleClick () {
@ -120,5 +120,5 @@
if ($parent) $parent.$emit('on-haschild-click'); if ($parent) $parent.$emit('on-haschild-click');
} }
} }
} };
</script> </script>

View file

@ -12,21 +12,21 @@
}, },
computed: { computed: {
classes () { classes () {
return `${prefixCls} ${prefixCls}-${this.type}` return `${prefixCls} ${prefixCls}-${this.type}`;
}, },
styles () { styles () {
let style = {}; let style = {};
if (!!this.size) { if (this.size) {
style['font-size'] = `${this.size}px`; style['font-size'] = `${this.size}px`;
} }
if (!!this.color) { if (this.color) {
style.color = this.color; style.color = this.color;
} }
return style; return style;
} }
} }
} };
</script> </script>

View file

@ -39,13 +39,13 @@
function addNum (num1, num2) { function addNum (num1, num2) {
let sq1, sq2, m; let sq1, sq2, m;
try { try {
sq1 = num1.toString().split(".")[1].length; sq1 = num1.toString().split('.')[1].length;
} }
catch (e) { catch (e) {
sq1 = 0; sq1 = 0;
} }
try { try {
sq2 = num2.toString().split(".")[1].length; sq2 = num2.toString().split('.')[1].length;
} }
catch (e) { catch (e) {
sq2 = 0; sq2 = 0;
@ -93,7 +93,7 @@
focused: false, focused: false,
upDisabled: false, upDisabled: false,
downDisabled: false downDisabled: false
} };
}, },
computed: { computed: {
wrapClasses () { wrapClasses () {
@ -104,7 +104,7 @@
[`${prefixCls}-disabled`]: this.disabled, [`${prefixCls}-disabled`]: this.disabled,
[`${prefixCls}-focused`]: this.focused [`${prefixCls}-focused`]: this.focused
} }
] ];
}, },
handlerClasses () { handlerClasses () {
return `${prefixCls}-handler-wrap`; return `${prefixCls}-handler-wrap`;
@ -116,7 +116,7 @@
{ {
[`${prefixCls}-handler-up-disabled`]: this.upDisabled [`${prefixCls}-handler-up-disabled`]: this.upDisabled
} }
] ];
}, },
innerUpClasses () { innerUpClasses () {
return `${prefixCls}-handler-up-inner ${iconPrefixCls} ${iconPrefixCls}-ios-arrow-up`; return `${prefixCls}-handler-up-inner ${iconPrefixCls} ${iconPrefixCls}-ios-arrow-up`;
@ -128,7 +128,7 @@
{ {
[`${prefixCls}-handler-down-disabled`]: this.downDisabled [`${prefixCls}-handler-down-disabled`]: this.downDisabled
} }
] ];
}, },
innerDownClasses () { innerDownClasses () {
return `${prefixCls}-handler-down-inner ${iconPrefixCls} ${iconPrefixCls}-ios-arrow-down`; return `${prefixCls}-handler-down-inner ${iconPrefixCls} ${iconPrefixCls}-ios-arrow-down`;
@ -190,10 +190,10 @@
keyDown (e) { keyDown (e) {
if (e.keyCode === 38) { if (e.keyCode === 38) {
e.preventDefault(); e.preventDefault();
this.up() this.up();
} else if (e.keyCode === 40) { } else if (e.keyCode === 40) {
e.preventDefault(); e.preventDefault();
this.down() this.down();
} }
}, },
change (event) { change (event) {
@ -238,5 +238,5 @@
this.changeVal(val); this.changeVal(val);
} }
} }
} };
</script> </script>

View file

@ -96,7 +96,7 @@
append: true, append: true,
slotReady: false, slotReady: false,
textareaStyles: {} textareaStyles: {}
} };
}, },
computed: { computed: {
wrapClasses () { wrapClasses () {
@ -108,7 +108,7 @@
[`${prefixCls}-group`]: this.prepend || this.append, [`${prefixCls}-group`]: this.prepend || this.append,
[`${prefixCls}-group-${this.size}`]: (this.prepend || this.append) && !!this.size [`${prefixCls}-group-${this.size}`]: (this.prepend || this.append) && !!this.size
} }
] ];
}, },
inputClasses () { inputClasses () {
return [ return [
@ -117,7 +117,7 @@
[`${prefixCls}-${this.size}`]: !!this.size, [`${prefixCls}-${this.size}`]: !!this.size,
[`${prefixCls}-disabled`]: this.disabled [`${prefixCls}-disabled`]: this.disabled
} }
] ];
}, },
textareaClasses () { textareaClasses () {
return [ return [
@ -125,7 +125,7 @@
{ {
[`${prefixCls}-disabled`]: this.disabled [`${prefixCls}-disabled`]: this.disabled
} }
] ];
} }
}, },
methods: { methods: {
@ -174,5 +174,5 @@
this.slotReady = true; this.slotReady = true;
this.resizeTextarea(); this.resizeTextarea();
} }
} };
</script> </script>

View file

@ -4,8 +4,6 @@
</div> </div>
</template> </template>
<script> <script>
import { oneOf } from '../../utils/assist';
const prefixCls = 'ivu-col'; const prefixCls = 'ivu-col';
export default { export default {
@ -24,7 +22,7 @@
data () { data () {
return { return {
gutter: 0 gutter: 0
} };
}, },
computed: { computed: {
classes () { classes () {
@ -63,11 +61,11 @@
style = { style = {
paddingLeft: this.gutter / 2 + 'px', paddingLeft: this.gutter / 2 + 'px',
paddingRight: this.gutter / 2 + 'px' paddingRight: this.gutter / 2 + 'px'
} };
} }
return style; return style;
} }
} }
} };
</script> </script>

View file

@ -41,7 +41,7 @@
[`${prefixCls}-${this.type}-${this.justify}`]: !!this.justify, [`${prefixCls}-${this.type}-${this.justify}`]: !!this.justify,
[`${this.className}`]: !!this.className [`${this.className}`]: !!this.className
} }
] ];
}, },
styles () { styles () {
let style = {}; let style = {};
@ -49,7 +49,7 @@
style = { style = {
marginLeft: this.gutter / -2 + 'px', marginLeft: this.gutter / -2 + 'px',
marginRight: this.gutter / -2 + 'px' marginRight: this.gutter / -2 + 'px'
} };
} }
return style; return style;
@ -72,5 +72,5 @@
ready () { ready () {
this.updateGutter(this.gutter); this.updateGutter(this.gutter);
} }
} };
</script> </script>

View file

@ -31,7 +31,7 @@ function hide() {
update({ update({
percent: 0 percent: 0
}); });
}, 200) }, 200);
}, 800); }, 800);
} }
@ -109,4 +109,4 @@ export default {
loadingBarInstance = null; loadingBarInstance = null;
instance.destroy(); instance.destroy();
} }
} };

View file

@ -36,7 +36,7 @@ LoadingBar.newInstance = properties => {
destroy () { destroy () {
document.body.removeChild(div); document.body.removeChild(div);
} }
} };
}; };
export default LoadingBar; export default LoadingBar;

View file

@ -49,12 +49,12 @@
[`${prefixCls}-inner-color-primary`]: this.color === 'primary' && this.status === 'success', [`${prefixCls}-inner-color-primary`]: this.color === 'primary' && this.status === 'success',
[`${prefixCls}-inner-failed-color-error`]: this.failedColor === 'error' && this.status === 'error' [`${prefixCls}-inner-failed-color-error`]: this.failedColor === 'error' && this.status === 'error'
} }
] ];
}, },
outerStyles () { outerStyles () {
return { return {
height: `${this.height}px` height: `${this.height}px`
} };
}, },
styles () { styles () {
let style = { let style = {
@ -73,5 +73,5 @@
return style; return style;
} }
} }
} };
</script> </script>

View file

@ -18,7 +18,7 @@
data () { data () {
return { return {
prefixCls: prefixCls prefixCls: prefixCls
} };
} }
} };
</script> </script>

View file

@ -19,7 +19,7 @@
data () { data () {
return { return {
active: false active: false
} };
}, },
computed: { computed: {
classes () { classes () {
@ -30,7 +30,7 @@
[`${prefixCls}-item-selected`]: this.active, [`${prefixCls}-item-selected`]: this.active,
[`${prefixCls}-item-disabled`]: this.disabled [`${prefixCls}-item-disabled`]: this.disabled
} }
] ];
} }
}, },
methods: { methods: {
@ -39,5 +39,5 @@
this.$dispatch('on-menu-item-select', this.key); this.$dispatch('on-menu-item-select', this.key);
} }
} }
} };
</script> </script>

View file

@ -26,7 +26,7 @@
openKeys: { openKeys: {
type: Array, type: Array,
default () { default () {
return [] return [];
} }
}, },
accordion: { accordion: {
@ -49,7 +49,7 @@
{ {
[`${prefixCls}-${this.mode}`]: this.mode [`${prefixCls}-${this.mode}`]: this.mode
} }
] ];
}, },
styles () { styles () {
let style = {}; let style = {};
@ -77,7 +77,7 @@
} else { } else {
groupItem.active = false; groupItem.active = false;
} }
}) });
} else if (subitem.$options.name === 'MenuItem') { } else if (subitem.$options.name === 'MenuItem') {
if (subitem.key === this.activeKey) { if (subitem.key === this.activeKey) {
subitem.active = true; subitem.active = true;
@ -86,15 +86,15 @@
subitem.active = false; subitem.active = false;
} }
} }
}) });
} else if (item.$options.name === 'MenuGroup') { } else if (item.$options.name === 'MenuGroup') {
item.$children.forEach(groupItem => { item.$children.forEach(groupItem => {
groupItem.active = groupItem.key === this.activeKey; groupItem.active = groupItem.key === this.activeKey;
}) });
} else if (item.$options.name === 'MenuItem') { } else if (item.$options.name === 'MenuItem') {
item.active = item.key === this.activeKey; item.active = item.key === this.activeKey;
} }
}) });
}, },
updateOpenKeys (key) { updateOpenKeys (key) {
const index = this.openKeys.indexOf(key); const index = this.openKeys.indexOf(key);
@ -109,7 +109,7 @@
if (item.$options.name === 'Submenu') { if (item.$options.name === 'Submenu') {
if (this.openKeys.indexOf(item.key) > -1) item.opened = true; if (this.openKeys.indexOf(item.key) > -1) item.opened = true;
} }
}) });
} }
}, },
compiled () { compiled () {
@ -128,5 +128,5 @@
this.$emit('on-open-change', this.openKeys); this.$emit('on-open-change', this.openKeys);
} }
} }
} };
</script> </script>

View file

@ -31,7 +31,7 @@
prefixCls: prefixCls, prefixCls: prefixCls,
active: false, active: false,
opened: false opened: false
} };
}, },
computed: { computed: {
classes () { classes () {
@ -42,7 +42,7 @@
[`${prefixCls}-opened`]: this.opened, [`${prefixCls}-opened`]: this.opened,
[`${prefixCls}-submenu-disabled`]: this.disabled [`${prefixCls}-submenu-disabled`]: this.disabled
} }
] ];
}, },
mode () { mode () {
return this.$parent.mode; return this.$parent.mode;
@ -106,5 +106,5 @@
return true; return true;
} }
} }
} };
</script> </script>

View file

@ -32,7 +32,7 @@ function notice (content, duration = defaultDuration, type, onClose) {
if (!onClose) { if (!onClose) {
onClose = function () { onClose = function () {
} };
} }
const iconType = iconTypes[type]; const iconType = iconTypes[type];
@ -61,7 +61,7 @@ function notice (content, duration = defaultDuration, type, onClose) {
return function () { return function () {
instance.remove(`${prefixKey}${target}`); instance.remove(`${prefixKey}${target}`);
} };
})(); })();
} }
@ -94,4 +94,4 @@ export default {
messageInstance = null; messageInstance = null;
instance.destroy(); instance.destroy();
} }
} };

View file

@ -55,13 +55,13 @@ Modal.newInstance = properties => {
return [ return [
`${prefixCls}-body-icon`, `${prefixCls}-body-icon`,
`${prefixCls}-body-icon-${this.iconType}` `${prefixCls}-body-icon-${this.iconType}`
] ];
}, },
iconNameCls () { iconNameCls () {
return [ return [
'ivu-icon', 'ivu-icon',
`ivu-icon-${this.iconName}` `ivu-icon-${this.iconName}`
] ];
} }
}, },
methods: { methods: {
@ -163,7 +163,7 @@ Modal.newInstance = properties => {
modal.$parent.remove(); modal.$parent.remove();
}, },
component: modal component: modal
} };
}; };
export default Modal; export default Modal;

View file

@ -79,7 +79,7 @@
wrapShow: false, wrapShow: false,
showHead: true, showHead: true,
buttonLoading: false buttonLoading: false
} };
}, },
computed: { computed: {
wrapClasses () { wrapClasses () {
@ -89,7 +89,7 @@
[`${prefixCls}-hidden`]: !this.wrapShow, [`${prefixCls}-hidden`]: !this.wrapShow,
[`${this.className}`]: !!this.className [`${this.className}`]: !!this.className
} }
] ];
}, },
maskClasses () { maskClasses () {
return `${prefixCls}-mask`; return `${prefixCls}-mask`;
@ -104,7 +104,7 @@
width: `${this.width}px` width: `${this.width}px`
}; };
const customStyle = !!this.style ? this.style : {}; const customStyle = this.style ? this.style : {};
Object.assign(style, styleWidth, customStyle); Object.assign(style, styleWidth, customStyle);
@ -135,7 +135,7 @@
EscClose (e) { EscClose (e) {
if (this.visible && this.closable) { if (this.visible && this.closable) {
if (e.keyCode === 27) { if (e.keyCode === 27) {
this.close() this.close();
} }
} }
}, },
@ -207,5 +207,5 @@
} }
} }
} }
} };
</script> </script>

View file

@ -114,4 +114,4 @@ export default {
noticeInstance = null; noticeInstance = null;
instance.destroy(); instance.destroy();
} }
} };

View file

@ -41,17 +41,17 @@
optsClasses () { optsClasses () {
return [ return [
`${prefixCls}-options` `${prefixCls}-options`
] ];
}, },
sizerClasses () { sizerClasses () {
return [ return [
`${prefixCls}-options-sizer` `${prefixCls}-options-sizer`
] ];
}, },
ElevatorClasses () { ElevatorClasses () {
return [ return [
`${prefixCls}-options-elevator` `${prefixCls}-options-elevator`
] ];
} }
}, },
methods: { methods: {
@ -83,5 +83,5 @@
} }
} }
} }
} };
</script> </script>

View file

@ -86,7 +86,7 @@
pageSizeOpts: { pageSizeOpts: {
type: Array, type: Array,
default () { default () {
return [10, 20, 30, 40] return [10, 20, 30, 40];
} }
}, },
size: { size: {
@ -120,7 +120,7 @@
data () { data () {
return { return {
prefixCls: prefixCls prefixCls: prefixCls
} };
}, },
computed: { computed: {
isSmall () { isSmall () {
@ -137,7 +137,7 @@
{ {
[`${this.class}`]: !!this.class [`${this.class}`]: !!this.class
} }
] ];
}, },
simplePagerClasses () { simplePagerClasses () {
return `${prefixCls}-simple-pager`; return `${prefixCls}-simple-pager`;
@ -149,7 +149,7 @@
[`${this.class}`]: !!this.class, [`${this.class}`]: !!this.class,
'mini': !!this.size 'mini': !!this.size
} }
] ];
}, },
prevClasses () { prevClasses () {
return [ return [
@ -157,7 +157,7 @@
{ {
[`${prefixCls}-disabled`]: this.current === 1 [`${prefixCls}-disabled`]: this.current === 1
} }
] ];
}, },
nextClasses () { nextClasses () {
return [ return [
@ -165,7 +165,7 @@
{ {
[`${prefixCls}-disabled`]: this.current === this.allPages [`${prefixCls}-disabled`]: this.current === this.allPages
} }
] ];
}, },
firstPageClasses () { firstPageClasses () {
return [ return [
@ -173,7 +173,7 @@
{ {
[`${prefixCls}-item-active`]: this.current === 1 [`${prefixCls}-item-active`]: this.current === 1
} }
] ];
}, },
lastPageClasses () { lastPageClasses () {
return [ return [
@ -181,7 +181,7 @@
{ {
[`${prefixCls}-item-active`]: this.current === this.allPages [`${prefixCls}-item-active`]: this.current === this.allPages
} }
] ];
} }
}, },
methods: { methods: {
@ -242,9 +242,9 @@
const val = parseInt(e.target.value); const val = parseInt(e.target.value);
if (key === 38) { if (key === 38) {
this.prev() this.prev();
} else if (key === 40) { } else if (key === 40) {
this.next() this.next();
} else if (key == 13) { } else if (key == 13) {
let page = 1; let page = 1;
@ -261,5 +261,5 @@
} }
} }
} }
} };
</script> </script>

View file

@ -87,7 +87,7 @@
return { return {
prefixCls: prefixCls, prefixCls: prefixCls,
showTitle: true showTitle: true
} };
}, },
computed: { computed: {
classes () { classes () {
@ -96,12 +96,12 @@
{ {
[`${prefixCls}-confirm`]: this.confirm [`${prefixCls}-confirm`]: this.confirm
} }
] ];
}, },
styles () { styles () {
let style = {}; let style = {};
if (!!this.width) { if (this.width) {
style.width = `${this.width}px`; style.width = `${this.width}px`;
} }
return style; return style;
@ -166,5 +166,5 @@
this.showTitle = this.$els.title.innerHTML != `<div class="${prefixCls}-title-inner"></div>`; this.showTitle = this.$els.title.innerHTML != `<div class="${prefixCls}-title-inner"></div>`;
} }
} }
} };
</script> </script>

View file

@ -56,7 +56,7 @@
type = 'ios-close'; type = 'ios-close';
break; break;
case 'success': case 'success':
type = 'ios-checkmark'; type = 'ios-checkmark';
break; break;
} }
@ -66,7 +66,7 @@
return { return {
width: `${this.percent}%`, width: `${this.percent}%`,
height: `${this.strokeWidth}px` height: `${this.strokeWidth}px`
} };
}, },
wrapClasses () { wrapClasses () {
return [ return [
@ -76,7 +76,7 @@
[`${prefixCls}-show-info`]: !this.hideInfo, [`${prefixCls}-show-info`]: !this.hideInfo,
} }
] ];
}, },
textClasses () { textClasses () {
return `${prefixCls}-text`; return `${prefixCls}-text`;
@ -117,5 +117,5 @@
} }
} }
} }
} };
</script> </script>

View file

@ -33,7 +33,7 @@
[`${prefixCls}-${this.size}`]: !!this.size, [`${prefixCls}-${this.size}`]: !!this.size,
[`${prefixCls}-${this.type}`]: !!this.type [`${prefixCls}-${this.type}`]: !!this.type
} }
] ];
} }
}, },
compiled () { compiled () {
@ -55,8 +55,8 @@
}, },
watch: { watch: {
model () { model () {
this.updateModel() this.updateModel();
} }
} }
} };
</script> </script>

View file

@ -32,7 +32,7 @@
return { return {
selected: false, selected: false,
group: false group: false
} };
}, },
computed: { computed: {
wrapClasses () { wrapClasses () {
@ -43,7 +43,7 @@
[`${prefixCls}-wrapper-checked`]: this.selected, [`${prefixCls}-wrapper-checked`]: this.selected,
[`${prefixCls}-wrapper-disabled`]: this.disabled [`${prefixCls}-wrapper-disabled`]: this.disabled
} }
] ];
}, },
radioClasses () { radioClasses () {
return [ return [
@ -52,7 +52,7 @@
[`${prefixCls}-checked`]: this.selected, [`${prefixCls}-checked`]: this.selected,
[`${prefixCls}-disabled`]: this.disabled [`${prefixCls}-disabled`]: this.disabled
} }
] ];
}, },
innerClasses () { innerClasses () {
return `${prefixCls}-inner`; return `${prefixCls}-inner`;
@ -91,5 +91,5 @@
this.updateModel(); this.updateModel();
} }
} }
} };
</script> </script>

View file

@ -14,7 +14,7 @@
data () { data () {
return { return {
popper: null popper: null
} };
}, },
methods: { methods: {
update () { update () {
@ -62,5 +62,5 @@
this.popper.destroy(); this.popper.destroy();
} }
} }
} };
</script> </script>

View file

@ -19,7 +19,7 @@
data () { data () {
return { return {
prefixCls: prefixCls prefixCls: prefixCls
} };
} }
} };
</script> </script>

View file

@ -26,7 +26,7 @@
isFocus: false, isFocus: false,
hidden: false, // for search hidden: false, // for search
searchLabel: '' // the value is slot,only for search searchLabel: '' // the value is slot,only for search
} };
}, },
computed: { computed: {
classes () { classes () {
@ -37,10 +37,10 @@
[`${prefixCls}-selected`]: this.selected, [`${prefixCls}-selected`]: this.selected,
[`${prefixCls}-focus`]: this.isFocus [`${prefixCls}-focus`]: this.isFocus
} }
] ];
}, },
showLabel () { showLabel () {
return (!!this.label) ? this.label : this.value; return (this.label) ? this.label : this.value;
} }
}, },
methods: { methods: {
@ -69,5 +69,5 @@
this.queryChange(val); this.queryChange(val);
} }
} }
} };
</script> </script>

View file

@ -96,7 +96,7 @@
inputLength: 20, inputLength: 20,
notFound: false, notFound: false,
slotChangeDuration: false // if slot change duration and in multiple, set true and after slot change, set false slotChangeDuration: false // if slot change duration and in multiple, set true and after slot change, set false
} };
}, },
computed: { computed: {
classes () { classes () {
@ -110,7 +110,7 @@
[`${prefixCls}-show-clear`]: this.showCloseIcon, [`${prefixCls}-show-clear`]: this.showCloseIcon,
[`${prefixCls}-${this.size}`]: !!this.size [`${prefixCls}-${this.size}`]: !!this.size
} }
] ];
}, },
showPlaceholder () { showPlaceholder () {
let status = false; let status = false;
@ -174,7 +174,7 @@
if (this.optionInstances.length) { if (this.optionInstances.length) {
this.optionInstances.forEach((child) => { this.optionInstances.forEach((child) => {
find(child); find(child);
}) });
} else { } else {
this.$children.forEach((child) => { this.$children.forEach((child) => {
find(child); find(child);
@ -252,7 +252,7 @@
selected.push({ selected.push({
value: option.value, value: option.value,
label: option.label label: option.label
}) });
} }
} }
} }
@ -435,7 +435,7 @@
const model = this.model; const model = this.model;
if (this.multiple) { if (this.multiple) {
//
} else { } else {
if (model !== '') { if (model !== '') {
this.findChild((child) => { this.findChild((child) => {
@ -561,5 +561,5 @@
} }
} }
} }
} };
</script> </script>

View file

@ -109,7 +109,7 @@
singlePosition: (this.value - this.min) / (this.max - this.min) * 100, singlePosition: (this.value - this.min) / (this.max - this.min) * 100,
firstPosition: (this.value[0] - this.min) / (this.max - this.min) * 100, firstPosition: (this.value[0] - this.min) / (this.max - this.min) * 100,
secondPosition: (this.value[1] - this.min) / (this.max - this.min) * 100 secondPosition: (this.value[1] - this.min) / (this.max - this.min) * 100
} };
}, },
computed: { computed: {
classes () { classes () {
@ -120,7 +120,7 @@
[`${prefixCls}-range`]: this.range, [`${prefixCls}-range`]: this.range,
[`${prefixCls}-disabled`]: this.disabled [`${prefixCls}-disabled`]: this.disabled
} }
] ];
}, },
buttonClasses () { buttonClasses () {
return [ return [
@ -153,11 +153,11 @@
style = { style = {
width: (this.value[1] - this.value[0]) / (this.max - this.min) * 100 + '%', width: (this.value[1] - this.value[0]) / (this.max - this.min) * 100 + '%',
left: (this.value[0] - this.min) / (this.max - this.min) * 100 + '%' left: (this.value[0] - this.min) / (this.max - this.min) * 100 + '%'
} };
} else { } else {
style = { style = {
width: (this.value - this.min) / (this.max - this.min) * 100 + '%' width: (this.value - this.min) / (this.max - this.min) * 100 + '%'
} };
} }
return style; return style;
@ -418,5 +418,5 @@
this.updateValue(this.value); this.updateValue(this.value);
} }
} }
} };
</script> </script>

View file

@ -26,7 +26,7 @@
data () { data () {
return { return {
showText: false showText: false
} };
}, },
computed: { computed: {
classes () { classes () {
@ -37,7 +37,7 @@
[`${prefixCls}-fix`]: this.fix, [`${prefixCls}-fix`]: this.fix,
[`${prefixCls}-show-text`]: this.showText, [`${prefixCls}-show-text`]: this.showText,
} }
] ];
}, },
mainClasses () { mainClasses () {
return `${prefixCls}-main`; return `${prefixCls}-main`;
@ -56,5 +56,5 @@
this.showText = true; this.showText = true;
} }
} }
} };
</script> </script>

View file

@ -43,7 +43,7 @@
stepNumber: '', stepNumber: '',
nextError: false, nextError: false,
total: 1 total: 1
} };
}, },
computed: { computed: {
wrapClasses () { wrapClasses () {
@ -54,12 +54,12 @@
[`${prefixCls}-custom`]: !!this.icon, [`${prefixCls}-custom`]: !!this.icon,
[`${prefixCls}-next-error`]: this.nextError [`${prefixCls}-next-error`]: this.nextError
} }
] ];
}, },
iconClasses () { iconClasses () {
let icon = ''; let icon = '';
if (!!this.icon) { if (this.icon) {
icon = this.icon; icon = this.icon;
} else { } else {
if (this.status == 'finish') { if (this.status == 'finish') {
@ -75,12 +75,12 @@
{ {
[`${iconPrefixCls}-${icon}`]: icon != '' [`${iconPrefixCls}-${icon}`]: icon != ''
} }
] ];
}, },
styles () { styles () {
return { return {
width: `${1/this.total*100}%` width: `${1/this.total*100}%`
} };
} }
}, },
watch: { watch: {
@ -90,5 +90,5 @@
} }
} }
} }
} };
</script> </script>

View file

@ -40,7 +40,7 @@
{ {
[`${prefixCls}-${this.size}`]: !!this.size [`${prefixCls}-${this.size}`]: !!this.size
} }
] ];
} }
}, },
ready () { ready () {
@ -103,5 +103,5 @@
this.updateCurrent(); this.updateCurrent();
} }
} }
} };
</script> </script>

View file

@ -36,7 +36,7 @@
[`${prefixCls}-disabled`]: this.disabled, [`${prefixCls}-disabled`]: this.disabled,
[`${prefixCls}-${this.size}`]: !!this.size [`${prefixCls}-${this.size}`]: !!this.size
} }
] ];
}, },
innerClasses () { innerClasses () {
return `${prefixCls}-inner`; return `${prefixCls}-inner`;
@ -52,5 +52,5 @@
this.$emit('on-change', this.checked); this.$emit('on-change', this.checked);
} }
} }
} };
</script> </script>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -26,7 +26,7 @@
return { return {
prefixCls: prefixCls, prefixCls: prefixCls,
show: true show: true
} };
}, },
computed: { computed: {
@ -47,5 +47,5 @@
this.updateNav(); this.updateNav();
} }
} }
} };
</script> </script>

View file

@ -58,7 +58,7 @@
navList: [], navList: [],
barWidth: 0, barWidth: 0,
barOffset: 0 barOffset: 0
} };
}, },
computed: { computed: {
classes () { classes () {
@ -69,7 +69,7 @@
[`${prefixCls}-mini`]: this.size === 'small' && this.type === 'line', [`${prefixCls}-mini`]: this.size === 'small' && this.type === 'line',
[`${prefixCls}-no-animation`]: !this.animated [`${prefixCls}-no-animation`]: !this.animated
} }
] ];
}, },
contentClasses () { contentClasses () {
return [ return [
@ -77,7 +77,7 @@
{ {
[`${prefixCls}-content-animated`]: this.animated [`${prefixCls}-content-animated`]: this.animated
} }
] ];
}, },
barClasses () { barClasses () {
return [ return [
@ -85,17 +85,17 @@
{ {
[`${prefixCls}-ink-bar-animated`]: this.animated [`${prefixCls}-ink-bar-animated`]: this.animated
} }
] ];
}, },
contentStyle () { contentStyle () {
const x = this.navList.findIndex((nav, index) => nav.key === this.activeKey); const x = this.navList.findIndex((nav) => nav.key === this.activeKey);
const p = x === 0 ? '0%' : `-${x}00%`; const p = x === 0 ? '0%' : `-${x}00%`;
let style = {}; let style = {};
if (x > -1) { if (x > -1) {
style = { style = {
transform: `translateX(${p}) translateZ(0px)` transform: `translateX(${p}) translateZ(0px)`
} };
} }
return style; return style;
}, },
@ -137,7 +137,7 @@
}, },
updateBar () { updateBar () {
this.$nextTick(() => { this.$nextTick(() => {
const index = this.navList.findIndex((nav, index) => nav.key === this.activeKey); const index = this.navList.findIndex((nav) => nav.key === this.activeKey);
const prevTabs = this.$els.nav.querySelectorAll(`.${prefixCls}-tab`); const prevTabs = this.$els.nav.querySelectorAll(`.${prefixCls}-tab`);
const tab = prevTabs[index]; const tab = prevTabs[index];
this.barWidth = parseFloat(getStyle(tab, 'width')); this.barWidth = parseFloat(getStyle(tab, 'width'));
@ -166,7 +166,7 @@
[`${prefixCls}-tab-disabled`]: item.disabled, [`${prefixCls}-tab-disabled`]: item.disabled,
[`${prefixCls}-tab-active`]: item.key === this.activeKey [`${prefixCls}-tab-active`]: item.key === this.activeKey
} }
] ];
}, },
handleChange (index) { handleChange (index) {
const nav = this.navList[index]; const nav = this.navList[index];
@ -210,5 +210,5 @@
this.updateBar(); this.updateBar();
} }
} }
} };
</script> </script>

View file

@ -30,7 +30,7 @@
data () { data () {
return { return {
closed: false closed: false
} };
}, },
computed: { computed: {
classes () { classes () {
@ -41,7 +41,7 @@
[`${prefixCls}-${this.type}`]: !!this.type, [`${prefixCls}-${this.type}`]: !!this.type,
[`${prefixCls}-closable`]: this.closable [`${prefixCls}-closable`]: this.closable
} }
] ];
}, },
textClasses () { textClasses () {
return `${prefixCls}-text`; return `${prefixCls}-text`;
@ -59,5 +59,5 @@
this.$emit('on-close', e); this.$emit('on-close', e);
} }
} }
} };
</script> </script>

View file

@ -20,7 +20,7 @@
data () { data () {
return { return {
dot: false dot: false
} };
}, },
ready () { ready () {
this.dot = this.$els.dot.innerHTML.length ? true : false; this.dot = this.$els.dot.innerHTML.length ? true : false;
@ -39,7 +39,7 @@
[`${prefixCls}-item-head-custom`]: this.dot, [`${prefixCls}-item-head-custom`]: this.dot,
[`${prefixCls}-item-head-${this.color}`]: this.headColorShow [`${prefixCls}-item-head-${this.color}`]: this.headColorShow
} }
] ];
}, },
headColorShow () { headColorShow () {
return this.color == 'blue' || this.color == 'red' || this.color == 'green'; return this.color == 'blue' || this.color == 'red' || this.color == 'green';
@ -51,7 +51,7 @@
style = { style = {
'color': this.color, 'color': this.color,
'border-color': this.color 'border-color': this.color
} };
} }
} }
@ -61,5 +61,5 @@
return `${prefixCls}-item-content`; return `${prefixCls}-item-content`;
} }
} }
} };
</script> </script>

View file

@ -20,8 +20,8 @@
{ {
[`${prefixCls}-pending`]: this.pending [`${prefixCls}-pending`]: this.pending
} }
] ];
} }
} }
} };
</script> </script>

View file

@ -46,7 +46,7 @@
data () { data () {
return { return {
prefixCls: prefixCls prefixCls: prefixCls
} };
}, },
methods: { methods: {
handleShowPopper() { handleShowPopper() {
@ -61,5 +61,5 @@
} }
} }
} }
} };
</script> </script>

View file

@ -50,7 +50,7 @@
showItems: [], showItems: [],
query: '', query: '',
showFooter: true showFooter: true
} };
}, },
computed: { computed: {
classes () { classes () {
@ -59,7 +59,7 @@
{ {
[`${this.prefixCls}-with-footer`]: this.showFooter [`${this.prefixCls}-with-footer`]: this.showFooter
} }
] ];
}, },
bodyClasses () { bodyClasses () {
return [ return [
@ -68,7 +68,7 @@
[`${this.prefixCls}-body-with-search`]: this.filterable, [`${this.prefixCls}-body-with-search`]: this.filterable,
[`${this.prefixCls}-body-with-footer`]: this.showFooter [`${this.prefixCls}-body-with-footer`]: this.showFooter
} }
] ];
}, },
count () { count () {
const validKeysCount = this.validKeysCount; const validKeysCount = this.validKeysCount;
@ -88,7 +88,7 @@
{ {
[`${this.prefixCls}-content-item-disabled`]: item.disabled [`${this.prefixCls}-content-item-disabled`]: item.disabled
} }
] ];
}, },
showLabel (item) { showLabel (item) {
return this.renderFormat(item); return this.renderFormat(item);
@ -125,5 +125,5 @@
this.updateFilteredData(); this.updateFilteredData();
} }
} }
} };
</script> </script>

View file

@ -28,5 +28,5 @@
this.$parent.moveTo('right'); this.$parent.moveTo('right');
} }
} }
} };
</script> </script>

View file

@ -29,5 +29,5 @@
this.query = ''; this.query = '';
} }
} }
} };
</script> </script>

View file

@ -47,7 +47,7 @@
data: { data: {
type: Array, type: Array,
default () { default () {
return [] return [];
} }
}, },
renderFormat: { renderFormat: {
@ -59,31 +59,31 @@
targetKeys: { targetKeys: {
type: Array, type: Array,
default () { default () {
return [] return [];
} }
}, },
selectedKeys: { selectedKeys: {
type: Array, type: Array,
default () { default () {
return [] return [];
} }
}, },
listStyle: { listStyle: {
type: Object, type: Object,
default () { default () {
return {} return {};
} }
}, },
titles: { titles: {
type: Array, type: Array,
default () { default () {
return ['源列表', '目的列表'] return ['源列表', '目的列表'];
} }
}, },
operations: { operations: {
type: Array, type: Array,
default () { default () {
return [] return [];
} }
}, },
filterable: { filterable: {
@ -113,13 +113,13 @@
rightData: [], rightData: [],
leftCheckedKeys: [], leftCheckedKeys: [],
rightCheckedKeys: [] rightCheckedKeys: []
} };
}, },
computed: { computed: {
classes () { classes () {
return [ return [
`${prefixCls}` `${prefixCls}`
] ];
}, },
leftValidKeysCount () { leftValidKeysCount () {
return this.getValidKeys('left').length; return this.getValidKeys('left').length;
@ -182,5 +182,5 @@
created () { created () {
this.splitData(true); this.splitData(true);
} }
} };
</script> </script>

View file

@ -16,4 +16,4 @@ export default {
unbind () { unbind () {
document.removeEventListener('click', this.documentHandler); document.removeEventListener('click', this.documentHandler);
} }
} };

View file

@ -1,5 +1,5 @@
// es6 polyfill // es6 polyfill
import 'core-js/fn/array/find-index' import 'core-js/fn/array/find-index';
import Affix from './components/affix'; import Affix from './components/affix';
import Alert from './components/alert'; import Alert from './components/alert';
@ -97,7 +97,7 @@ const iview = {
const install = function (Vue) { const install = function (Vue) {
Object.keys(iview).forEach((key) => { Object.keys(iview).forEach((key) => {
Vue.component(key, iview[key]) Vue.component(key, iview[key]);
}); });
Vue.prototype.$Loading = LoadingBar; Vue.prototype.$Loading = LoadingBar;
@ -111,4 +111,4 @@ if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue); install(window.Vue);
} }
module.exports = Object.assign(iview, {install}); module.exports = Object.assign(iview, {install}); // eslint-disable-line no-undef

View file

@ -131,4 +131,4 @@ function deepCopy(data) {
return o; return o;
} }
export {deepCopy} export {deepCopy};

View file

@ -105,4 +105,4 @@ export default function calcTextareaHeight(targetNode, minRows = null, maxRows =
minHeight: `${minHeight}px`, minHeight: `${minHeight}px`,
maxHeight: `${maxHeight}px` maxHeight: `${maxHeight}px`
}; };
}; }