Add css classes to <body> in Ember.js

老子叫甜甜 提交于 2019-12-01 07:25:58

问题


How to add css class to the body tag on specific route? I tried to use body tag in a handlebars template but didn't work...

Update: After some googling I came with this solution. Not sure that this is the best way to do this, but it works.

App.SomeRoute = Em.Route.extend
  activate: ->
    Em.$('body').addClass 'some-class'

  deactivate: ->
    Em.$('body').removeClass 'some-class'

来源:https://stackoverflow.com/questions/20781154/add-css-classes-to-body-in-ember-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!