如何在模板中呈现长变量

时间:2019-07-05 15:00:57

标签: go

我正在尝试在Go模板中显示二维码,但是显示变量有很大的问题。

如果我使用此变量{{.QRCodeURL}},则输出如下:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAABrrFhUAAAABlBMVEX///8AAABVwtN+AAABnklEQVR42uzdUa6EIAxAUd/+N/1WMNGWgmDP/TY6nMwHAYyXJEmSJEmSJEmSJEmSJEmSJP0l+3WfVc8DAAAAAAAAANQBVF1/N4Dq5wEAAAAAAAAA6gCiA8hePwsMAAAAAAAAAPA+wCxAAAAAAAAAAMC+AE/vDwAAAAAAAADYDyAL9vS+n9sZAgAAAAAAAD4AkD24WLURcuxJUQAAAAAAAOBggFmAV5cAAAAAAACAgwFGDzxEFzK2m/gAAAAAAAAAjQGqNiKqDlBu948AAAAAAAAAGgFEFz5GN0aOWVgBAAAAAAAAPgwQHUh2QAAAAAAAAACAfQDuHhR9kbHqxcflJ0UBAAAAAACAhgCrAaMDBAAAAAAAAACc96Gl7ATqtQURAAAAAAAAoDFA9vrRH/76CxQAAAAAAAAAgGkfThqdGC2fCAEAAAAAAAAAygCOPSEKAAAAAAAAACif0IwemAAAAAAAAAAA7LMxEp0APZ0QAQAAAAAAAADWAYz+8CxYdoIFAAAAAAAAAJAkSZIkSZIkSZIkSZIkSZLUqP8AAAD//40bOYFOlt+GAAAAAElFTkSuQmCC

当我尝试以html代码显示图像时,示例代码:

<img src="{{.QRCodeURL}}" alt="qrcode" />

输出是这样的:

<img src="#ZgotmplZ" alt="qrcode" />

当我尝试以html内容打印时,不会打印变量的完整数据吗?我在哪里错了?

0 个答案:

没有答案