-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
executable file
·74 lines (66 loc) · 1.72 KB
/
index.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
'use strict';
const home = httpVueLoader('components/home.vue');
const countries = httpVueLoader('components/countries.vue');
const country = httpVueLoader('components/country.vue');
const categories = httpVueLoader('components/categories.vue');
const category = httpVueLoader('components/category.vue');
const search = httpVueLoader('components/search.vue');
const routes = [
{ path: '/', component: home },
{ path: '/countries', component: countries },
{ path: '/country/:country', component: country },
{ path: '/categories', component: categories },
{ path: '/category/:category', component: category },
{ path: '/search', component: search },
];
const router = new VueRouter({
routes,
});
var app1 = new Vue({
router,
el: '#app',
data: {
countries: [],
categories: [],
channels: [],
category: [],
country: [],
title: '',
src: '',
search: '',
},
methods: {
submit(el) {
this.search = el;
if (el.length < 2) {
this.channels = [];
} else {
uibuilder.send({ payload: { search: el.toLowerCase() } });
}
this.$router.push('/search').catch(err => {});
},
},
mounted: function() {
uibuilder.start();
var vueApp = this;
uibuilder.onChange('msg', function(msg) {
if (msg.payload.hasOwnProperty('countries')) {
vueApp.countries = msg.payload.countries;
}
if (msg.payload.hasOwnProperty('categories')) {
vueApp.categories = msg.payload.categories;
}
if (msg.payload.hasOwnProperty('channels')) {
vueApp.channels = msg.payload.channels;
}
if (msg.payload.hasOwnProperty('results')) {
if (!msg.payload.results[0].title === false) {
console.log(msg);
vueApp.channels = msg.payload.results;
} else {
vueApp.channels = [];
}
}
});
},
});