【问题标题】:Alter property of Emberjs更改 Emberjs 的属性
【发布时间】:2017-04-17 20:23:47
【问题描述】:

我是 EmberJs 的新手,我正在做一个项目,我需要在 ember-cli 生成的模板中添加 javascript 和 css 属性,我的困难在于找到 javascript 和 css 文件

When I search the project for the class or id, it shows me only what is in the dist that can not be changed

Can anyone with emberJS experience help me make these changes?






Template with i w[enter image description here][1]anna to work:

  <div class="top-banner">
    {{ top-banner pageBanner=model.news.banner }}
    {{ search-component exchangeTypes=model.exchangeType}}
  </div>

  {{bread-crumbs breadcrumbs=breadcrumbs}}

  <section class="container destaque noticia">
    {{title-content light=model.news.title}}
    <div class="row informacoes-news">
      <div class="col-xs-12 noticia-texto">
        {{{model.news.content}}}
      </div>
    </div>
  </section>

    {{share-bar}}
  <div class="col-md-1 col-xs-12 download-container">
      <a class="teste" href="{{model.news.pdf}}">Download</a>
  </div>

  {{featured-news type="featured_news" noticias=model.featuredNews news=true}}

  {{contact-widget states=model.brazilState}}

  {{rodape-sitemap}}

【问题讨论】:

  • 那么,您需要知道 .css 文件、模板和控制器在项目结构中的位置吗?到目前为止,您尝试过什么?

标签: ember.js


【解决方案1】:

这里是 ember-twiddle 中的基础知识大纲:https://ember-twiddle.com/f537e51449c1c49ae32794b9d15bc6ff?openFiles=templates.application.hbs%2C

听起来你继承了一些代码 - 并且你会从花几个小时学习 Ember 指南教程中受益:https://guides.emberjs.com/current

旅途愉快!


应用程序.hbs

<h1>{{appName}}</h1>

<h2>this is the application.hbs template (base template)</h2>

{{info-list}}


控制器/application.js

import Ember from 'ember';

export default Ember.Controller.extend({
  appName: 'this is a property value seen in the application template...',
});


应用程序.css

body {
  background: lightgreen;
}


模板/组件/info-list.hbs

<ul class='item-list'>
  <li>...</li>
</ul>

【讨论】:

  • 非常感谢,帮了大忙!
  • 另外,组件的 .js 和 .hbs 文件的工作方式类似于上面的控制器和模板对。您可以将其视为模块创建的“范围”。
猜你喜欢
  • 1970-01-01
  • 2023-04-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-06
  • 2014-11-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多