Skip to content

Commit 961d728

Browse files
committed
removed huge toy data from repo and included "chance" faker library
1 parent ab2b8d0 commit 961d728

File tree

5 files changed

+32
-98515
lines changed

5 files changed

+32
-98515
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"bootstrap": "^4.1.3",
4040
"chai": "^4.1.2",
4141
"chalk": "^2.0.1",
42+
"chance": "^1.0.18",
4243
"copy-webpack-plugin": "^4.0.1",
4344
"cross-env": "^5.0.1",
4445
"css-loader": "^0.28.0",

src/App.vue

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
<script>
3838
import VueBootstrap4Table from './components/VueBootstrap4Table.vue'
39-
39+
var chance = require('chance').Chance(88);
4040
export default {
4141
name: 'App',
4242
data: function() {
@@ -199,14 +199,30 @@
199199
},
200200
methods: {
201201
fetchData() {
202-
let self = this;
203-
axios.get('https://raw.githubusercontent.com/rubanraj54/vue-bootstrap4-table/develop/src/assets/toy_data/users_500.json')
204-
.then(function(response) {
205-
self.rows = response.data;
206-
})
207-
.catch(function(error) {
208-
console.log(error);
209-
});
202+
let user;
203+
let users = [];
204+
for (let i = 1; i <=500; i++) {
205+
user = {
206+
id : i,
207+
name: {
208+
first_name: chance.first(),
209+
last_name: chance.last(),
210+
},
211+
age: chance.age(),
212+
address: {
213+
city: chance.city(),
214+
street: chance.address(),
215+
postcode: chance.postcode(),
216+
country: chance.country()
217+
},
218+
salary: chance.integer({ min: 1500, max: 3000 }),
219+
email: chance.email(),
220+
website: chance.domain(),
221+
mobile: chance.phone()
222+
}
223+
users.push(user);
224+
}
225+
this.rows = users;
210226
},
211227
onSelectRows(payload) {
212228
console.log(payload);
@@ -278,7 +294,6 @@
278294
mounted() {
279295
let self = this;
280296
this.fetchData();
281-
282297
// let test = [1,2,3,4,5,6,7]
283298
284299
// test.some((val,index) => {

0 commit comments

Comments
 (0)