admin 管理员组文章数量: 1086019
The Glimmer website states:
Just drop your Glimmer ponents into an Ember app. You won’t need to change a thing.
I’ve been following the official Ember quick start tutorial. I replaced the contents of the generated people-list.js
ponent with this:
import Component from '@glimmer/ponent';
export default class PeopleList extends Component {
}
and I get an error in the browser console stating that @glimmer/ponent
is undefined. After I run yarn add @glimmer/ponent
to add the dependency, I get a new error from Broccoli.
Additionally, whenever I use '@' before a variable in the people-list.hbs
template, the template fails to pile. How do I get the Glimmer ponent to work in my Ember app?
The Glimmer website states:
Just drop your Glimmer ponents into an Ember app. You won’t need to change a thing.
I’ve been following the official Ember quick start tutorial. I replaced the contents of the generated people-list.js
ponent with this:
import Component from '@glimmer/ponent';
export default class PeopleList extends Component {
}
and I get an error in the browser console stating that @glimmer/ponent
is undefined. After I run yarn add @glimmer/ponent
to add the dependency, I get a new error from Broccoli.
Additionally, whenever I use '@' before a variable in the people-list.hbs
template, the template fails to pile. How do I get the Glimmer ponent to work in my Ember app?
2 Answers
Reset to default 5To use glimmer in an ember app today (May 1st, 2019),
yarn add --dev @glimmer/ponent@beta
then
import Component from '@glimmer/ponent';
import { tracked } from '@glimmer/tracking';
export default class MyComponent extends Component {
@tracked number = 0;
increment() {
this.number++;
}
}
to see this in action, take a look at a fresh Octane App: https://github./ember-cli/ember-octane-blueprint
Currently you can't use it for existing ember app. but you can try it brand new app. By installing ember new my-glimmer-app -b https://github./glimmerjs/glimmer-blueprint.git
If you go with yarn global add ember-cli/ember-cli
this way then you need to uninstall existing ember-cli (npm uninstall -g ember-cli
)
本文标签: javascriptHow do I use Glimmer components inside an Ember appStack Overflow
版权声明:本文标题:javascript - How do I use Glimmer components inside an Ember app? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744074815a2529151.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论