pfaffman
(Jay Pfaffman)
2024 年 2 月 15 日午後 7:21
1
Continuing the discussion from DButton no longer supports @action as a string. Please refactor to use an closure action instead :
But essentially, the message you’re seeing means that you need to change something like
{{d-button action="blah"}}
to something like:
{{d-button action=(action "blah")}}
This saved me!
My question now (besides how did it take me 9 months to do this) is whether/when to use {{d-button}}
vs <DButton>
「いいね!」 2
david
(David Taylor)
2024 年 2 月 15 日午後 7:22
2
The modern ember pattern is to use ‘angle bracket’ syntax to invoke components. So <DButton>
is preferred.
We lint for this in core, but haven’t yet extended it to themes/plugins.
「いいね!」 5
pfaffman
(Jay Pfaffman)
2024 年 2 月 15 日午後 7:30
3
Oh. Hooray. That’s what I thought!
It was especially confusing since the error message compained about <DButton>
but I am using {{d-button}}
. I’ll go about fixing those Real Soon Now.
Aha. Thanks for the explanation.
「いいね!」 4
pfaffman
(Jay Pfaffman)
2024 年 2 月 15 日午後 10:06
4
Wait. So we gave up @actionParam
in <DButton>
and do this to pass stuff:
@action={{fn this.addExtraVars this.extraVarsSmtp}}
but in <NavItem>
we still stil have this to pass parameters to a route
@route="pfaffmanager.servers.show"
@routeParam={{server.id}}
「いいね!」 3
It’s a particular case here.
<NavItem>
calls <LinkTo>
that requires the name of the route to link to (route
) and the value to fill the dynamic segment (model,
an ID here) to be separate.
<LinkTo
@route={{@route}}
@model={{@routeParam}}
>{{this.contents}}
</LinkTo>
Does that make sense?
「いいね!」 4
pfaffman
(Jay Pfaffman)
2024 年 2 月 16 日午後 7:47
6
It’s a fine explanation and I do understand it, but I wouldn’t say it makes sense .
「いいね!」 1
It makes sense because there is no function/action involved here (and it’s not needed) in NavItem.
You only want to pass parameters from component to component. You see what I mean? Sorry, I’m so bad at explaining things.
「いいね!」 3
pfaffman
(Jay Pfaffman)
クローズされました:
2024 年 3 月 17 日午後 8:13
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.