Skip to content
This repository was archived by the owner on Apr 1, 2022. It is now read-only.

Commit a62069c

Browse files
author
Ken Berkeley
committed
1.lib/ optimize code style 2.examples/ eliminate locales of moment.js
1 parent 04ca02d commit a62069c

File tree

16 files changed

+86
-77
lines changed

16 files changed

+86
-77
lines changed

examples/dist/client.04139e5e.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/dist/client.3cc4bf6b.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/dist/client.59a562c9.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/dist/client.6eae235d.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/dist/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<title>Vue 2 Datatable Examples</title>
66
<link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
77
<link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
8-
<link href="client.3cc4bf6b.css" rel="stylesheet"></head>
8+
<link href="client.04139e5e.css" rel="stylesheet"></head>
99
<body>
1010

1111
<div id="app"></div>
1212

1313
<script src="//cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
1414
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
15-
<script type="text/javascript" src="client.6eae235d.js"></script></body>
15+
<script type="text/javascript" src="client.59a562c9.js"></script></body>
1616
</html>

examples/src/Advanced/comps/th-Filter.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<a href="javascript:;" data-toggle="dropdown">
55
<i class="fa fa-filter" :class="{ 'text-muted': !keyword }"></i>
66
</a>
7-
<ul class="dropdown-menu p-3">
7+
<ul class="dropdown-menu" style="padding: 3px">
88
<div class="input-group input-group-sm">
99
<input type="search" class="form-control" ref="input"
1010
v-model="keyword" @keydown.enter="search" :placeholder="`Search ${field}...`">
@@ -46,7 +46,4 @@ input[type=search]::-webkit-search-cancel-button {
4646
-webkit-appearance: searchfield-cancel-button;
4747
cursor: pointer;
4848
}
49-
.p-3 {
50-
padding: 3px;
51-
}
5249
</style>

examples/src/App.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<a href="#advanced">Advanced</a>
3939
</li>
4040
</ul>
41-
<div class="tab-content m-t-10">
41+
<div class="tab-content" style="margin-top: 10px">
4242
<div class="tab-pane" :class="{ active: showTab === 'basic' }">
4343
<basic v-if="showTab === 'basic'" />
4444
</div>
@@ -86,7 +86,4 @@ footer {
8686
text-align: center;
8787
color: #afafaf;
8888
}
89-
.m-t-10 {
90-
margin-top: 10px;
91-
}
9289
</style>
Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
1-
const Random = require('mockjs').Random
21
import uniq from 'lodash/uniq'
32
import without from 'lodash/without'
3+
const Random = require('mockjs').Random
44

55
const total = 120 // how many rows to generate
66
const getRandomUid = () => Random.integer(1, total)
77

8-
const users = []
9-
for (let i = 1; i <= total; i++) {
10-
users.push({
11-
uid: i,
12-
name: Random.name(),
13-
age: Random.integer(0, 100),
14-
email: Random.email(),
15-
friends: without(
16-
uniq(Array(getRandomUid()).fill().map(() => getRandomUid())),
17-
i // exclude `myself`
18-
),
19-
country: Random.pick(
20-
['US', 'UK', 'China', 'Russia', 'Germany', 'France', 'Japan']
21-
),
22-
lang: Random.pick(
23-
['English', 'Chinese', 'Russian', 'German', 'French', 'Japanese']
24-
),
25-
programLang: Random.pick(
26-
['C', 'C++', 'Java', 'C#', 'Python', 'Ruby', 'PHP', 'JavaScript', 'Go']
27-
),
28-
ip: Random.ip(),
29-
color: Random.color(),
30-
createTime: +new Date(Random.datetime('yyyy/MM/dd HH:mm:ss')) // to timestamp
31-
})
32-
}
8+
const users = Array(total).fill().map((item, idx) => ({
9+
uid: idx,
10+
name: Random.name(),
11+
age: Random.integer(0, 100),
12+
email: Random.email(),
13+
friends: without(
14+
uniq(Array(getRandomUid()).fill().map(() => getRandomUid())),
15+
idx // exclude `myself`
16+
),
17+
country: Random.pick(
18+
['US', 'UK', 'China', 'Russia', 'Germany', 'France', 'Japan']
19+
),
20+
lang: Random.pick(
21+
['English', 'Chinese', 'Russian', 'German', 'French', 'Japanese']
22+
),
23+
programLang: Random.pick(
24+
['C', 'C++', 'Java', 'C#', 'Python', 'Ruby', 'PHP', 'JavaScript', 'Go']
25+
),
26+
ip: Random.ip(),
27+
color: Random.color(),
28+
createTime: +new Date(Random.datetime('yyyy/MM/dd HH:mm:ss')) // to timestamp
29+
}))
3330

3431
export default users

examples/src/_mockData/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export default function mockData(query) {
3030
}
3131
})
3232

33-
if (sort) rows = orderBy(rows, sort, order)
33+
if (sort) {
34+
rows = orderBy(rows, sort, order)
35+
}
3436

3537
const res = {
3638
rows: rows.slice(offset, offset + limit),
@@ -42,7 +44,7 @@ export default function mockData(query) {
4244
}
4345

4446
const consoleGroupName = 'Mock data - ' + moment().format('YYYY-MM-DD HH:mm:ss')
45-
setTimeout(() => { // avoid blocking the main thread
47+
setTimeout(() => {
4648
console.group(consoleGroupName)
4749
console.info('Receive:', query)
4850
console.info('Respond:', res)

lib/HeadSort.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export default {
1212
field: { type: String, required: true },
1313
query: { type: Object, required: true }
1414
},
15-
data: () => ({ order: '' }),
15+
data: () => ({
16+
order: ''
17+
}),
1618
computed: {
1719
cls () {
1820
return `fa-sort-${this.order}`.replace(/-$/, '')

0 commit comments

Comments
 (0)