-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathxml.mjs
32 lines (31 loc) · 884 Bytes
/
xml.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Grid } from '../../dist/main.esm.js'
export default {
name: 'Json',
components: {
Grid
},
data() {
return {
sort: true,
search: true,
pagination: true,
columns: ['Location', 'Change Frequency', 'Priority'],
server: {
url: 'https://gridjs.io/sitemap.xml',
handle: res => {
return res.text().then(str => new window.DOMParser().parseFromString(str, 'text/xml'))
},
then: data => {
return Array.from(data.querySelectorAll('url')).map(row => [
row.querySelector('loc').innerHTML,
row.querySelector('changefreq').innerHTML,
row.querySelector('priority').innerHTML
])
}
}
}
},
template: `
<div><grid :columns="columns" :server="server" :pagination="pagination" :search="search" :sort="sort"></grid></div>
`
}