bate
This commit is contained in:
parent
3cdd790fe7
commit
db2edebeaf
21
collection.js
Normal file
21
collection.js
Normal file
@ -0,0 +1,21 @@
|
||||
import https from 'https'
|
||||
|
||||
export default function (url) {
|
||||
if (!this.item.link) return false;
|
||||
|
||||
var reg = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/;
|
||||
if (!reg.test(url)) url = "https://" + url;
|
||||
|
||||
https.get(url, resp => {
|
||||
let data = ''
|
||||
resp.on('data', chunk => data += chunk)
|
||||
resp.on('end', () => {
|
||||
console.log(JSON.parse(data).explanation)
|
||||
})
|
||||
}).on('error', err => {
|
||||
console.log(err.message)
|
||||
})
|
||||
//this.$axios.get(this.item.link).then((res) => {
|
||||
// console.log(res.data);
|
||||
//});
|
||||
}
|
Loading…
Reference in New Issue
Block a user