-2
템플릿에 if else 블록이 있습니다. else if
에 해당하는 경우 else
또는 else if
여기가 골란 템플릿이 제대로 작동하지 않습니다.
되지 않습니다이 경우 내 템플릿
를 렌더링하지 않습니다 또한 나는 text/template
을 사용하면 html/template
페이지가 완전히 비어 있기 때문에
//the template
<script>
{{if.PassChange}}
swal("{{.Lang.Success}}", "{{.Lang.PleaseLogin}}", "success")
{{end}}
{{if.UserExists}}
swal("{{.Lang.Fail}}", "{{.Lang.AlreadyMember}}", "error")
{{end}}
</script>
//rendering part
BasePath.Get("/", func(w http.ResponseWriter, r *http.Request) {
tpl.ExecResponse(w, struct{Lang map[string]string ; UserExists bool}{Lang:lang.GetLang(r),UserExists:true})
})
이미지와 특히 두 번째 이미지는 읽기가 어렵습니다. 질문에 텍스트를 붙여 넣으십시오. 또한 어떤 라이브러리를 사용하여 템플릿을 렌더링합니까? –
@MellowMarmot 방금 – nikoss
부정적인 투표를 한 은하계의 똑똑한 사람들은 너와 내가 우리와 함께 너의 믿을 수없는 지식을 나눠 주길 바래. – nikoss