Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

旧スタイルでもサブフォルダにファイルを移動 #15

Merged
merged 2 commits into from Feb 27, 2021

Conversation

mugijiru
Copy link
Owner

@mugijiru mugijiru commented Feb 27, 2021

旧スタイルだと
#13 にも書いたように DefaultResolver(GlobalsResolver) の parseName が使われる。

その場合は temoplate から {{hoge/fuga}} と呼び出した際には
Hoge という Namespace の FugaComponent を探しに行くという挙動になっている。

そのため、そういう Namespace を用意してあげて、
サブフォルダ内のファイルはそこに所属するように書いてあげる必要がある。

3階層以上になるとどうなるかはわからん……

https://github.com/emberjs/ember.js/blob/e2007b6ecb046fd06f6b43c381e8a1128914ad43/packages/%40ember/application/globals-resolver.js#L221

を見ると {{hoge/fuga/piyo}} と書くと
Hoge.Fuga.PiyoComponent を探しに行きそうではある

上記理由のため
元の todo-item.js.es6 の実装を
todo-item/list-item.js.es6 に移動した
}
}
});
window.TodoItem = Ember.Namespace.create();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description に書いた理由のため Namespace を用意している。

@@ -1,4 +1,4 @@
TodoApp.TodoItemFormModalComponent = Ember.Component.extend({
TodoItem.FormModalComponent = Ember.Component.extend({
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mugijiru mugijiru merged commit f8d4908 into v1.x Feb 27, 2021
@mugijiru mugijiru deleted the nested-component-for-v1.x branch February 27, 2021 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant