У меня есть эта функция jQuery , которую я хотел бы преобразовать для использования в компоненте Vue:
$('button').click(function(){
$('button').toggleClass('active');
$('.title').toggleClass('active');
$('nav').toggleClass('active');
});
Я пробовал это, но безуспешно:
export default {
name: 'newComponent',
// component data, methods, etc are now able to use imported variables
methods: {
btnClick: (function() {
this.button.active != this.button.active;
this.title.active != this.title.active;
this.nav.active != this.nav.active;
})
}
}
Как получить доступ к параметрам CSS из компонента?
.title {
float: left;
width: 100%;
background-color: $color-2;
max-height: 0px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
overflow: hidden;
@include transition(all .55s);
&.active {
max-height: 100px;
@include transition(all 1.3s);