/* общие для всех тем */
.navigation { /* style */ }
.sect-one { /* style */ }
.project-title { /* style */ }
/* конкретные для темы evil вдобавок к общим */
body.theme-evil .navigation { /* style */ }
body.theme-evil .sect-one { /* style */ }
body.theme-evil .project-title { /* style */ }
/* конкретные для темы hacker вдобавок к общим */
body.theme-hacker .navigation { /* style */ }
body.theme-hacker .sect-one { /* style */ }
body.theme-hacker .project-title { /* style */ }
/* ..... */
$(document).ready(function() {
var themes = ['evil', 'hacker', 'basic'];
var oldTheme = 'basic';
themes.forEach(function(theme) {
$('#' + theme).click(function() {
$('body').removeClass('theme-' + oldTheme);
$('body').addClass('theme-' + theme);
oldTheme = theme;
});
});
});
Vue.use(VueAuth, {
auth: require('./components/auth'),
http: require('@websanova/vue-auth/drivers/http/axios.1.x.js'),
router: require('@websanova/vue-auth/drivers/router/vue-router.2.x.js'),
rolesVar: 'role',
loginData: {url: '/api-token-auth/', method: 'POST', redirect: '/somepage', fetchUser: true},
fetchData: {url: '/users/me/', method: 'GET', enabled: true},
refreshData: {url: '/users/me/', method: 'GET', enabled: true, interval: 5},
parseUserData: function(res) { return res; },
logoutData: {url: 'auth/logout', method: 'POST', redirect: '/login', makeRequest: false},
});
module.exports = {
request: function (req, token) {
this.options.http._setHeaders.call(this, req, { Authorization: 'Token ' + token });
},
response: function (res) {
let token = res.data.token
if (token) {
return token;
}
}
};
$count = array_count_values($arr);
$arr = array_filter($arr, function($n) use($count) {
return $count[$n] < 2;
});
$count = array_count_values($arr);
$arr = array_unique(array_filter($arr, function($n) use($count) {
return $count[$n] % 2;
}));
@input="onInput($event, product)"
methods: {
onInput(e, product) {
product.quantity = Math.max(0, parseInt(e.target.value) || 0);
},
},
watch: {
products: {
deep: true,
handler() {
this.products.forEach(n => n.quantity = Math.max(0, parseInt(n.quantity) || 0));
},
},
},