link-to
からURLを取得して印刷する方法はありますか?link-toからURLを出力するにはどうすればよいですか?
{{#link-to "route.name" params}}
https://example.com/route/name/params {{!-- Change this with the URL of link-to --}}
{{/link-to}}
link-to
からURLを取得して印刷する方法はありますか?link-toからURLを出力するにはどうすればよいですか?
{{#link-to "route.name" params}}
https://example.com/route/name/params {{!-- Change this with the URL of link-to --}}
{{/link-to}}
ember-href-toアドオンを試すことができます。 href-to
ヘルパーを使用してURLを取得します。
あなたはLinkComponent
を拡張し、そのhref
プロパティを露出し、独自のコンポーネントを作成することができます。
component.js:
import Ember from 'ember';
export default Ember.LinkComponent.extend({
});
template.hbs:その後、
{{#if hasBlock}}
{{yield href}}
{{else}}
{{linkTitle}}
{{/if}}
そして、それを使用します。
を{{#my-link "route.name" as |href| }}
{{href}}
{{/my-link}}