عرض محتوى مختلف للعرض على الهاتف المحمول في ملف .gjs

إذا أردت، يمكنك وضع فئة كاملة داخل استدعاء renderInOutlet:

import { apiInitializer } from "discourse/lib/api";
import Component from "@glimmer/component";
import { service } from "@ember/service";

export default apiInitializer((api) => {
  api.renderInOutlet(
    "composer-after-save-or-cancel",
    class extends Component {
      @service site;

      <template>
        {{#if this.site.mobileView}}
          Mobile!
        {{else}}
          Normal!
        {{/if}}
      </template>
    }
  );
});

ولكن حل .lookup() معقول أيضًا - هذا ما يفعله @service في الكواليس على أي حال :ok_hand:

6 إعجابات