将.js转换为vue组件

时间:2019-07-09 18:29:21

标签: javascript vue.js vue-component

我有this jQuery function想要转换为在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);

1 个答案:

答案 0 :(得分:0)

好吧,这很简单:

import pygame

pygame.init()

win = pygame.display.set_mode((500,500))

还是谢谢!

相关问题