|
@@ -4,27 +4,44 @@ var Vue = require('vue'),
|
|
|
VueMaterial = require('vue-material'),
|
|
VueMaterial = require('vue-material'),
|
|
|
VueResource = require('vue-resource');
|
|
VueResource = require('vue-resource');
|
|
|
|
|
|
|
|
|
|
+var Light = require('../views/light.vue');
|
|
|
|
|
+
|
|
|
Vue.use(VueMaterial);
|
|
Vue.use(VueMaterial);
|
|
|
Vue.use(VueResource);
|
|
Vue.use(VueResource);
|
|
|
|
|
|
|
|
var App = new Vue({
|
|
var App = new Vue({
|
|
|
el: '#app',
|
|
el: '#app',
|
|
|
http: {
|
|
http: {
|
|
|
- root: 'https://test.nebulon.info/api',
|
|
|
|
|
|
|
+ root: '/api',
|
|
|
|
|
+ },
|
|
|
|
|
+ components: {
|
|
|
|
|
+ lightItem: Light
|
|
|
|
|
+ },
|
|
|
|
|
+ data: {
|
|
|
|
|
+ lights: [],
|
|
|
|
|
+ selectedLight: {}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- toggleSidenav() {
|
|
|
|
|
|
|
+ toggleSidenav: function () {
|
|
|
this.$refs.leftSidenav.toggle();
|
|
this.$refs.leftSidenav.toggle();
|
|
|
},
|
|
},
|
|
|
- sidenavOpen() {
|
|
|
|
|
|
|
+ sidenavOpen: function () {
|
|
|
console.log('sidenav open');
|
|
console.log('sidenav open');
|
|
|
|
|
+ },
|
|
|
|
|
+ selectLight: function (light) {
|
|
|
|
|
+ this.$data.selectedLight = light;
|
|
|
|
|
+ this.$refs.leftSidenav.close();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
mounted: function () {
|
|
mounted: function () {
|
|
|
console.log('mounted');
|
|
console.log('mounted');
|
|
|
|
|
|
|
|
|
|
+ var that = this;
|
|
|
|
|
+
|
|
|
this.$http.get('lights', { responseType: 'text' }).then(function (result) {
|
|
this.$http.get('lights', { responseType: 'text' }).then(function (result) {
|
|
|
console.log('result', result);
|
|
console.log('result', result);
|
|
|
|
|
+ that.$data.lights = result.body.lights;
|
|
|
|
|
+ that.$data.selectedLight = result.body.lights[3];
|
|
|
}, function (error) {
|
|
}, function (error) {
|
|
|
console.log('error', error);
|
|
console.log('error', error);
|
|
|
});
|
|
});
|