How Alloy can config a exporters.prometheus.endpoint

From prometheusexporter, we can see that:

exporters:
  prometheus:
    endpoint: "1.2.3.4:1234"
    ......

Otel-contrib collector can export data in the Prometheus format, which allows it to be scraped by a Prometheus server.

May I know how Alloy can do the same?

Not sure what you mean, Alloy has its own prometheus exporter as well, see prometheus.remote_write | Grafana Alloy documentation