所以我想
别名
另一个视图中的视图。但我得到了一个错误,我调用的JSON无法呈现。
员工视图
alias AuthAppWeb.EdtrView
def render("employee_dtr.json", %{employee: employee}) do
%{
id: employee.id,
personal_info: employee.personal_info,
edtr: render_one(employee.edtr, __MODULE__, "edtr.json", as: EdtrView)
}end
EdtRyVIEW
def render("edtr.json", %{edtr: edtr}) do
%{
id: edtr.id,
m_in: edtr.m_in,
m_out: edtr.m_out,
a_in: edtr.a_in,
a_out: edtr.a_out,
o_in: edtr.o_in,
o_out: edtr.o_out,
status: edtr.status,
sub_status: edtr.sub_status,
dtr_date: edtr.dtr_date
}end