bi-element-ui 1.1.9 → 1.1.91
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/.browserslistrc +3 -3
- package/.eslintignore +1 -1
- package/.prettierrc +8 -8
- package/.prettierrc.json +8 -8
- package/.vscode/extensions.json +3 -3
- package/.vscode/settings.json +2 -2
- package/README.md +148 -148
- package/cypress.json +3 -3
- package/dist/css/about.734427a8.css +1 -0
- package/dist/css/chunk-vendors.8b3b4be2.css +22 -0
- package/dist/css/index.9e71d803.css +1 -0
- package/dist/index.html +1 -1
- package/dist/js/about.4ff3d4f9.js +2 -0
- package/dist/js/chunk-vendors.d907e1f2.js +387 -0
- package/dist/js/index.66b4892a.js +11 -0
- package/lib/demo.html +10 -10
- package/package-lock2.json +17309 -17309
- package/package.json +1 -1
- package/src/components/BiDatePicker/datePickerOption.js +163 -163
- package/src/components/BiDatePicker/index.vue +59 -59
- package/src/components/BiTable/columu.vue +81 -81
- package/src/components/BiTable/forced.js +63 -63
- package/src/components/BiTable/index.js +6 -6
- package/src/components/BiTable/render.vue +13 -13
- package/src/components/BiTable/table.vue +179 -179
- package/src/components/BiTableColumn/Group.vue +275 -275
- package/src/components/BiTableColumn/api.js +16 -16
- package/src/components/BiTooltipIcon/index.vue +63 -63
- package/src/components/EditBtn.vue +15 -15
- package/src/components/FreeButton/index.vue +50 -50
- package/src/components/Pagination/index.vue +91 -91
- package/src/components/Pagination/scrollTo.js +65 -65
- package/src/router/index.js +44 -44
- package/src/store/index.js +11 -11
- package/src/views/Date.vue +96 -96
- package/src/views/Home.vue +11 -0
- package/src/views/Layout.vue +34 -34
- package/src/views/Scene.vue +111 -111
- package/src/views/showData.vue +2 -2
- package/tests/e2e/.eslintrc.js +10 -10
- package/tests/e2e/plugins/index.js +25 -25
- package/tests/e2e/specs/test.js +8 -8
- package/tests/e2e/support/commands.js +25 -25
- package/tests/e2e/support/index.js +20 -20
- package/tests/unit/example.spec.js +13 -13
- package//345/211/215/347/253/257ui/346/240/267/345/274/217/350/247/204/350/214/203.md +101 -101
- package/dist/css/about.f927ac1d.css +0 -1
- package/dist/css/chunk-vendors.bce393fb.css +0 -1
- package/dist/css/index.9da9fdde.css +0 -1
- package/dist/js/about.49a721d0.js +0 -2
- package/dist/js/chunk-vendors.008a0caf.js +0 -313
- package/dist/js/index.e9532c02.js +0 -11
- package/pnpm-lock.yaml +0 -13329
- /package/lib/{bi-element-ui.common.js → Bi-element-ui.common.js} +0 -0
- /package/lib/{bi-element-ui.css → Bi-element-ui.css} +0 -0
- /package/lib/{bi-element-ui.umd.js → Bi-element-ui.umd.js} +0 -0
- /package/lib/{bi-element-ui.umd.min.js → Bi-element-ui.umd.min.js} +0 -0
@@ -1,63 +1,63 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author:gjh
|
3
|
-
* @Date: 2021-12-30 14:27:46
|
4
|
-
* @LastEditTime: 2021-12-30 16:15:22
|
5
|
-
* @LastEditors: Please set LastEditors
|
6
|
-
* @Description: 基于bi项目表格图标提示的需求
|
7
|
-
* @FilePath: \bi-element-ui\packages\TooltipIcon\src\index.vue
|
8
|
-
-->
|
9
|
-
<template>
|
10
|
-
<span>
|
11
|
-
<!-- 支持属性props的写法和插槽替换的写法 -->
|
12
|
-
<slot name="tip-label">
|
13
|
-
<span>{{ label }}</span>
|
14
|
-
</slot>
|
15
|
-
<el-tooltip class="tooltip-icon" :effect="effect" :placement="placement" v-bind="$attrs">
|
16
|
-
<template slot="content">
|
17
|
-
<slot name="tip-content">
|
18
|
-
<div v-html="content"></div>
|
19
|
-
</slot>
|
20
|
-
</template>
|
21
|
-
|
22
|
-
<slot name="tip-icon">
|
23
|
-
<span style="margin-left: 5px">
|
24
|
-
<!-- 这里默认采用的是el-icon的图标 -->
|
25
|
-
<i :class="icon"></i>
|
26
|
-
</span>
|
27
|
-
</slot>
|
28
|
-
</el-tooltip>
|
29
|
-
</span>
|
30
|
-
</template>
|
31
|
-
|
32
|
-
<script>
|
33
|
-
export default {
|
34
|
-
name: 'BiTooltipIcon',
|
35
|
-
props: {
|
36
|
-
label: {
|
37
|
-
type: String,
|
38
|
-
default: '头部标题'
|
39
|
-
},
|
40
|
-
icon: {
|
41
|
-
type: String,
|
42
|
-
default: 'el-icon-warning-outline'
|
43
|
-
},
|
44
|
-
content: {
|
45
|
-
type: String,
|
46
|
-
default: '提示内容'
|
47
|
-
},
|
48
|
-
placement: {
|
49
|
-
type: String,
|
50
|
-
default: 'bottom'
|
51
|
-
},
|
52
|
-
effect: {
|
53
|
-
type: String,
|
54
|
-
default: 'dark'
|
55
|
-
}
|
56
|
-
},
|
57
|
-
data() {
|
58
|
-
return {}
|
59
|
-
}
|
60
|
-
}
|
61
|
-
</script>
|
62
|
-
|
63
|
-
<style></style>
|
1
|
+
<!--
|
2
|
+
* @Author:gjh
|
3
|
+
* @Date: 2021-12-30 14:27:46
|
4
|
+
* @LastEditTime: 2021-12-30 16:15:22
|
5
|
+
* @LastEditors: Please set LastEditors
|
6
|
+
* @Description: 基于bi项目表格图标提示的需求
|
7
|
+
* @FilePath: \bi-element-ui\packages\TooltipIcon\src\index.vue
|
8
|
+
-->
|
9
|
+
<template>
|
10
|
+
<span>
|
11
|
+
<!-- 支持属性props的写法和插槽替换的写法 -->
|
12
|
+
<slot name="tip-label">
|
13
|
+
<span>{{ label }}</span>
|
14
|
+
</slot>
|
15
|
+
<el-tooltip class="tooltip-icon" :effect="effect" :placement="placement" v-bind="$attrs">
|
16
|
+
<template slot="content">
|
17
|
+
<slot name="tip-content">
|
18
|
+
<div v-html="content"></div>
|
19
|
+
</slot>
|
20
|
+
</template>
|
21
|
+
|
22
|
+
<slot name="tip-icon">
|
23
|
+
<span style="margin-left: 5px">
|
24
|
+
<!-- 这里默认采用的是el-icon的图标 -->
|
25
|
+
<i :class="icon"></i>
|
26
|
+
</span>
|
27
|
+
</slot>
|
28
|
+
</el-tooltip>
|
29
|
+
</span>
|
30
|
+
</template>
|
31
|
+
|
32
|
+
<script>
|
33
|
+
export default {
|
34
|
+
name: 'BiTooltipIcon',
|
35
|
+
props: {
|
36
|
+
label: {
|
37
|
+
type: String,
|
38
|
+
default: '头部标题'
|
39
|
+
},
|
40
|
+
icon: {
|
41
|
+
type: String,
|
42
|
+
default: 'el-icon-warning-outline'
|
43
|
+
},
|
44
|
+
content: {
|
45
|
+
type: String,
|
46
|
+
default: '提示内容'
|
47
|
+
},
|
48
|
+
placement: {
|
49
|
+
type: String,
|
50
|
+
default: 'bottom'
|
51
|
+
},
|
52
|
+
effect: {
|
53
|
+
type: String,
|
54
|
+
default: 'dark'
|
55
|
+
}
|
56
|
+
},
|
57
|
+
data() {
|
58
|
+
return {}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
</script>
|
62
|
+
|
63
|
+
<style></style>
|
@@ -1,15 +1,15 @@
|
|
1
|
-
<template>
|
2
|
-
<el-button size="mini" @click="todo">编辑</el-button>
|
3
|
-
</template>
|
4
|
-
|
5
|
-
<script>
|
6
|
-
export default {
|
7
|
-
props: ['row', 'column'],
|
8
|
-
|
9
|
-
methods: {
|
10
|
-
todo() {
|
11
|
-
this.$emit('row-edit', this.row)
|
12
|
-
}
|
13
|
-
}
|
14
|
-
}
|
15
|
-
</script>
|
1
|
+
<template>
|
2
|
+
<el-button size="mini" @click="todo">编辑</el-button>
|
3
|
+
</template>
|
4
|
+
|
5
|
+
<script>
|
6
|
+
export default {
|
7
|
+
props: ['row', 'column'],
|
8
|
+
|
9
|
+
methods: {
|
10
|
+
todo() {
|
11
|
+
this.$emit('row-edit', this.row)
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
</script>
|
@@ -1,50 +1,50 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="free-button">
|
3
|
-
<slot></slot>
|
4
|
-
<el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
|
5
|
-
<el-button type="primary" icon="el-icon-edit">编辑</el-button>
|
6
|
-
<el-button type="success" icon="el-icon-plus">新增</el-button>
|
7
|
-
<el-button type="info" icon="el-icon-download">导出</el-button>
|
8
|
-
<el-button type="warning" icon="el-icon-upload2">导入</el-button>
|
9
|
-
<el-button type="danger" icon="el-icon-delete">删除</el-button>
|
10
|
-
</div>
|
11
|
-
</template>
|
12
|
-
|
13
|
-
<script>
|
14
|
-
const EVENT_NAMES = ['search', 'add', 'edit', 'delete', 'import', 'exprot']
|
15
|
-
|
16
|
-
const methods = {}
|
17
|
-
// const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1)
|
18
|
-
|
19
|
-
EVENT_NAMES.forEach((name) => {
|
20
|
-
methods[name] = function () {
|
21
|
-
this.$emit(name)
|
22
|
-
}
|
23
|
-
})
|
24
|
-
|
25
|
-
export default {
|
26
|
-
name: 'FreeButton',
|
27
|
-
props: {
|
28
|
-
btnsCol: {
|
29
|
-
type: Array,
|
30
|
-
default: () => {
|
31
|
-
return [
|
32
|
-
{ type: 'search', label: '查询', event: 'onSearch' },
|
33
|
-
{ type: 'delete', label: '删除', event: 'onDelete' }
|
34
|
-
]
|
35
|
-
}
|
36
|
-
},
|
37
|
-
btnsProps: Object
|
38
|
-
},
|
39
|
-
methods: {
|
40
|
-
bindEvents(name) {
|
41
|
-
this.$emit(name)
|
42
|
-
}
|
43
|
-
}
|
44
|
-
}
|
45
|
-
</script>
|
46
|
-
<style>
|
47
|
-
.free-button {
|
48
|
-
margin: 10px 0;
|
49
|
-
}
|
50
|
-
</style>
|
1
|
+
<template>
|
2
|
+
<div class="free-button">
|
3
|
+
<slot></slot>
|
4
|
+
<el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
|
5
|
+
<el-button type="primary" icon="el-icon-edit">编辑</el-button>
|
6
|
+
<el-button type="success" icon="el-icon-plus">新增</el-button>
|
7
|
+
<el-button type="info" icon="el-icon-download">导出</el-button>
|
8
|
+
<el-button type="warning" icon="el-icon-upload2">导入</el-button>
|
9
|
+
<el-button type="danger" icon="el-icon-delete">删除</el-button>
|
10
|
+
</div>
|
11
|
+
</template>
|
12
|
+
|
13
|
+
<script>
|
14
|
+
const EVENT_NAMES = ['search', 'add', 'edit', 'delete', 'import', 'exprot']
|
15
|
+
|
16
|
+
const methods = {}
|
17
|
+
// const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1)
|
18
|
+
|
19
|
+
EVENT_NAMES.forEach((name) => {
|
20
|
+
methods[name] = function () {
|
21
|
+
this.$emit(name)
|
22
|
+
}
|
23
|
+
})
|
24
|
+
|
25
|
+
export default {
|
26
|
+
name: 'FreeButton',
|
27
|
+
props: {
|
28
|
+
btnsCol: {
|
29
|
+
type: Array,
|
30
|
+
default: () => {
|
31
|
+
return [
|
32
|
+
{ type: 'search', label: '查询', event: 'onSearch' },
|
33
|
+
{ type: 'delete', label: '删除', event: 'onDelete' }
|
34
|
+
]
|
35
|
+
}
|
36
|
+
},
|
37
|
+
btnsProps: Object
|
38
|
+
},
|
39
|
+
methods: {
|
40
|
+
bindEvents(name) {
|
41
|
+
this.$emit(name)
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
</script>
|
46
|
+
<style>
|
47
|
+
.free-button {
|
48
|
+
margin: 10px 0;
|
49
|
+
}
|
50
|
+
</style>
|
@@ -1,91 +1,91 @@
|
|
1
|
-
<template>
|
2
|
-
<div :class="{ hidden: hidden }" class="pagination-container">
|
3
|
-
<el-pagination :background="background" :current-page.sync="currentPage" :page-size.sync="pageSize" :layout="layout" :page-sizes="pageSizes" :total="total" v-bind="$attrs" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
4
|
-
</div>
|
5
|
-
</template>
|
6
|
-
|
7
|
-
<script>
|
8
|
-
import { scrollTo } from './scrollTo'
|
9
|
-
|
10
|
-
export default {
|
11
|
-
name: 'Pagination',
|
12
|
-
props: {
|
13
|
-
total: {
|
14
|
-
required: true,
|
15
|
-
type: Number
|
16
|
-
},
|
17
|
-
page: {
|
18
|
-
type: Number,
|
19
|
-
default: 1
|
20
|
-
},
|
21
|
-
limit: {
|
22
|
-
type: Number,
|
23
|
-
default: 20
|
24
|
-
},
|
25
|
-
pageSizes: {
|
26
|
-
type: Array,
|
27
|
-
default() {
|
28
|
-
return [10, 20, 30, 50]
|
29
|
-
}
|
30
|
-
},
|
31
|
-
layout: {
|
32
|
-
type: String,
|
33
|
-
default: 'total, sizes, prev, pager, next, jumper'
|
34
|
-
},
|
35
|
-
background: {
|
36
|
-
type: Boolean,
|
37
|
-
default: true
|
38
|
-
},
|
39
|
-
autoScroll: {
|
40
|
-
type: Boolean,
|
41
|
-
default: true
|
42
|
-
},
|
43
|
-
hidden: {
|
44
|
-
type: Boolean,
|
45
|
-
default: false
|
46
|
-
}
|
47
|
-
},
|
48
|
-
computed: {
|
49
|
-
currentPage: {
|
50
|
-
get() {
|
51
|
-
return this.page
|
52
|
-
},
|
53
|
-
set(val) {
|
54
|
-
this.$emit('update:page', val)
|
55
|
-
}
|
56
|
-
},
|
57
|
-
pageSize: {
|
58
|
-
get() {
|
59
|
-
return this.limit
|
60
|
-
},
|
61
|
-
set(val) {
|
62
|
-
this.$emit('update:limit', val)
|
63
|
-
}
|
64
|
-
}
|
65
|
-
},
|
66
|
-
methods: {
|
67
|
-
handleSizeChange(val) {
|
68
|
-
this.$emit('pagination', { page: this.currentPage, limit: val })
|
69
|
-
if (this.autoScroll) {
|
70
|
-
scrollTo(0, 800)
|
71
|
-
}
|
72
|
-
},
|
73
|
-
handleCurrentChange(val) {
|
74
|
-
this.$emit('pagination', { page: val, limit: this.pageSize })
|
75
|
-
if (this.autoScroll) {
|
76
|
-
scrollTo(0, 800)
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
81
|
-
</script>
|
82
|
-
|
83
|
-
<style scoped>
|
84
|
-
.pagination-container {
|
85
|
-
background: #fff;
|
86
|
-
padding: 20px 16px;
|
87
|
-
}
|
88
|
-
.pagination-container.hidden {
|
89
|
-
display: none;
|
90
|
-
}
|
91
|
-
</style>
|
1
|
+
<template>
|
2
|
+
<div :class="{ hidden: hidden }" class="pagination-container">
|
3
|
+
<el-pagination :background="background" :current-page.sync="currentPage" :page-size.sync="pageSize" :layout="layout" :page-sizes="pageSizes" :total="total" v-bind="$attrs" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
4
|
+
</div>
|
5
|
+
</template>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
import { scrollTo } from './scrollTo'
|
9
|
+
|
10
|
+
export default {
|
11
|
+
name: 'Pagination',
|
12
|
+
props: {
|
13
|
+
total: {
|
14
|
+
required: true,
|
15
|
+
type: Number
|
16
|
+
},
|
17
|
+
page: {
|
18
|
+
type: Number,
|
19
|
+
default: 1
|
20
|
+
},
|
21
|
+
limit: {
|
22
|
+
type: Number,
|
23
|
+
default: 20
|
24
|
+
},
|
25
|
+
pageSizes: {
|
26
|
+
type: Array,
|
27
|
+
default() {
|
28
|
+
return [10, 20, 30, 50]
|
29
|
+
}
|
30
|
+
},
|
31
|
+
layout: {
|
32
|
+
type: String,
|
33
|
+
default: 'total, sizes, prev, pager, next, jumper'
|
34
|
+
},
|
35
|
+
background: {
|
36
|
+
type: Boolean,
|
37
|
+
default: true
|
38
|
+
},
|
39
|
+
autoScroll: {
|
40
|
+
type: Boolean,
|
41
|
+
default: true
|
42
|
+
},
|
43
|
+
hidden: {
|
44
|
+
type: Boolean,
|
45
|
+
default: false
|
46
|
+
}
|
47
|
+
},
|
48
|
+
computed: {
|
49
|
+
currentPage: {
|
50
|
+
get() {
|
51
|
+
return this.page
|
52
|
+
},
|
53
|
+
set(val) {
|
54
|
+
this.$emit('update:page', val)
|
55
|
+
}
|
56
|
+
},
|
57
|
+
pageSize: {
|
58
|
+
get() {
|
59
|
+
return this.limit
|
60
|
+
},
|
61
|
+
set(val) {
|
62
|
+
this.$emit('update:limit', val)
|
63
|
+
}
|
64
|
+
}
|
65
|
+
},
|
66
|
+
methods: {
|
67
|
+
handleSizeChange(val) {
|
68
|
+
this.$emit('pagination', { page: this.currentPage, limit: val })
|
69
|
+
if (this.autoScroll) {
|
70
|
+
scrollTo(0, 800)
|
71
|
+
}
|
72
|
+
},
|
73
|
+
handleCurrentChange(val) {
|
74
|
+
this.$emit('pagination', { page: val, limit: this.pageSize })
|
75
|
+
if (this.autoScroll) {
|
76
|
+
scrollTo(0, 800)
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
</script>
|
82
|
+
|
83
|
+
<style scoped>
|
84
|
+
.pagination-container {
|
85
|
+
background: #fff;
|
86
|
+
padding: 20px 16px;
|
87
|
+
}
|
88
|
+
.pagination-container.hidden {
|
89
|
+
display: none;
|
90
|
+
}
|
91
|
+
</style>
|
@@ -1,65 +1,65 @@
|
|
1
|
-
Math.easeInOutQuad = function (t, b, c, d) {
|
2
|
-
t /= d / 2
|
3
|
-
if (t < 1) {
|
4
|
-
return (c / 2) * t * t + b
|
5
|
-
}
|
6
|
-
t--
|
7
|
-
return (-c / 2) * (t * (t - 2) - 1) + b
|
8
|
-
}
|
9
|
-
|
10
|
-
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
|
11
|
-
var requestAnimFrame = (function () {
|
12
|
-
return (
|
13
|
-
window.requestAnimationFrame ||
|
14
|
-
window.webkitRequestAnimationFrame ||
|
15
|
-
window.mozRequestAnimationFrame ||
|
16
|
-
function (callback) {
|
17
|
-
window.setTimeout(callback, 1000 / 60)
|
18
|
-
}
|
19
|
-
)
|
20
|
-
})()
|
21
|
-
|
22
|
-
/**
|
23
|
-
* Because it's so fucking difficult to detect the scrolling element, just move them all
|
24
|
-
* @param {number} amount
|
25
|
-
*/
|
26
|
-
function move(amount) {
|
27
|
-
document.documentElement.scrollTop = amount
|
28
|
-
document.body.parentNode.scrollTop = amount
|
29
|
-
document.body.scrollTop = amount
|
30
|
-
}
|
31
|
-
|
32
|
-
function position() {
|
33
|
-
return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
|
34
|
-
}
|
35
|
-
|
36
|
-
/**
|
37
|
-
* @param {number} to
|
38
|
-
* @param {number} duration
|
39
|
-
* @param {Function} callback
|
40
|
-
*/
|
41
|
-
export function scrollTo(to, duration, callback) {
|
42
|
-
const start = position()
|
43
|
-
const change = to - start
|
44
|
-
const increment = 20
|
45
|
-
let currentTime = 0
|
46
|
-
duration = typeof duration === 'undefined' ? 500 : duration
|
47
|
-
var animateScroll = function () {
|
48
|
-
// increment the time
|
49
|
-
currentTime += increment
|
50
|
-
// find the value with the quadratic in-out easing function
|
51
|
-
var val = Math.easeInOutQuad(currentTime, start, change, duration)
|
52
|
-
// move the document.body
|
53
|
-
move(val)
|
54
|
-
// do the animation unless its over
|
55
|
-
if (currentTime < duration) {
|
56
|
-
requestAnimFrame(animateScroll)
|
57
|
-
} else {
|
58
|
-
if (callback && typeof callback === 'function') {
|
59
|
-
// the animation is done so lets callback
|
60
|
-
callback()
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}
|
64
|
-
animateScroll()
|
65
|
-
}
|
1
|
+
Math.easeInOutQuad = function (t, b, c, d) {
|
2
|
+
t /= d / 2
|
3
|
+
if (t < 1) {
|
4
|
+
return (c / 2) * t * t + b
|
5
|
+
}
|
6
|
+
t--
|
7
|
+
return (-c / 2) * (t * (t - 2) - 1) + b
|
8
|
+
}
|
9
|
+
|
10
|
+
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
|
11
|
+
var requestAnimFrame = (function () {
|
12
|
+
return (
|
13
|
+
window.requestAnimationFrame ||
|
14
|
+
window.webkitRequestAnimationFrame ||
|
15
|
+
window.mozRequestAnimationFrame ||
|
16
|
+
function (callback) {
|
17
|
+
window.setTimeout(callback, 1000 / 60)
|
18
|
+
}
|
19
|
+
)
|
20
|
+
})()
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Because it's so fucking difficult to detect the scrolling element, just move them all
|
24
|
+
* @param {number} amount
|
25
|
+
*/
|
26
|
+
function move(amount) {
|
27
|
+
document.documentElement.scrollTop = amount
|
28
|
+
document.body.parentNode.scrollTop = amount
|
29
|
+
document.body.scrollTop = amount
|
30
|
+
}
|
31
|
+
|
32
|
+
function position() {
|
33
|
+
return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* @param {number} to
|
38
|
+
* @param {number} duration
|
39
|
+
* @param {Function} callback
|
40
|
+
*/
|
41
|
+
export function scrollTo(to, duration, callback) {
|
42
|
+
const start = position()
|
43
|
+
const change = to - start
|
44
|
+
const increment = 20
|
45
|
+
let currentTime = 0
|
46
|
+
duration = typeof duration === 'undefined' ? 500 : duration
|
47
|
+
var animateScroll = function () {
|
48
|
+
// increment the time
|
49
|
+
currentTime += increment
|
50
|
+
// find the value with the quadratic in-out easing function
|
51
|
+
var val = Math.easeInOutQuad(currentTime, start, change, duration)
|
52
|
+
// move the document.body
|
53
|
+
move(val)
|
54
|
+
// do the animation unless its over
|
55
|
+
if (currentTime < duration) {
|
56
|
+
requestAnimFrame(animateScroll)
|
57
|
+
} else {
|
58
|
+
if (callback && typeof callback === 'function') {
|
59
|
+
// the animation is done so lets callback
|
60
|
+
callback()
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
animateScroll()
|
65
|
+
}
|
package/src/router/index.js
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
import Vue from 'vue'
|
2
|
-
import VueRouter from 'vue-router'
|
3
|
-
import Home from '../views/Home.vue'
|
4
|
-
|
5
|
-
Vue.use(VueRouter)
|
6
|
-
|
7
|
-
const routes = [
|
8
|
-
{
|
9
|
-
path: '/',
|
10
|
-
name: 'Home',
|
11
|
-
component: Home
|
12
|
-
},
|
13
|
-
// {
|
14
|
-
// path: '/scene',
|
15
|
-
// name: 'Scene',
|
16
|
-
// component: () => import(/* webpackChunkName: "about" */ '../views/Scene.vue')
|
17
|
-
// },
|
18
|
-
{
|
19
|
-
path: '/date',
|
20
|
-
name: 'Date',
|
21
|
-
component: () => import(/* webpackChunkName: "about" */ '../views/Date.vue')
|
22
|
-
},
|
23
|
-
{
|
24
|
-
path: '/layout',
|
25
|
-
name: 'Layout',
|
26
|
-
component: () => import(/* webpackChunkName: "about" */ '../views/Layout.vue')
|
27
|
-
},
|
28
|
-
{
|
29
|
-
path: '/table',
|
30
|
-
name: 'Table',
|
31
|
-
component: () => import(/* webpackChunkName: "about" */ '../views/Table.vue')
|
32
|
-
},
|
33
|
-
{
|
34
|
-
path: '/showData',
|
35
|
-
name: 'showData',
|
36
|
-
component: () => import(/* webpackChunkName: "about" */ '../views/showData.vue')
|
37
|
-
}
|
38
|
-
]
|
39
|
-
|
40
|
-
const router = new VueRouter({
|
41
|
-
routes
|
42
|
-
})
|
43
|
-
|
44
|
-
export default router
|
1
|
+
import Vue from 'vue'
|
2
|
+
import VueRouter from 'vue-router'
|
3
|
+
import Home from '../views/Home.vue'
|
4
|
+
|
5
|
+
Vue.use(VueRouter)
|
6
|
+
|
7
|
+
const routes = [
|
8
|
+
{
|
9
|
+
path: '/',
|
10
|
+
name: 'Home',
|
11
|
+
component: Home
|
12
|
+
},
|
13
|
+
// {
|
14
|
+
// path: '/scene',
|
15
|
+
// name: 'Scene',
|
16
|
+
// component: () => import(/* webpackChunkName: "about" */ '../views/Scene.vue')
|
17
|
+
// },
|
18
|
+
{
|
19
|
+
path: '/date',
|
20
|
+
name: 'Date',
|
21
|
+
component: () => import(/* webpackChunkName: "about" */ '../views/Date.vue')
|
22
|
+
},
|
23
|
+
{
|
24
|
+
path: '/layout',
|
25
|
+
name: 'Layout',
|
26
|
+
component: () => import(/* webpackChunkName: "about" */ '../views/Layout.vue')
|
27
|
+
},
|
28
|
+
{
|
29
|
+
path: '/table',
|
30
|
+
name: 'Table',
|
31
|
+
component: () => import(/* webpackChunkName: "about" */ '../views/Table.vue')
|
32
|
+
},
|
33
|
+
{
|
34
|
+
path: '/showData',
|
35
|
+
name: 'showData',
|
36
|
+
component: () => import(/* webpackChunkName: "about" */ '../views/showData.vue')
|
37
|
+
}
|
38
|
+
]
|
39
|
+
|
40
|
+
const router = new VueRouter({
|
41
|
+
routes
|
42
|
+
})
|
43
|
+
|
44
|
+
export default router
|