0

我正在研究 nodejs 和 mongodb。当我放置此代码时;<%- postContent %>,它呈现为以下格式:

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>
<img title="Image Title" class="alignnone wp-image-9453 size-full" src="https://example.com/images/2017/03/image-name-1.jpg" alt="image alt here" width="847" height="507" srcset="https://example.com/images/2017/03/image-name-1.jpg 847w, https://example.com/images/2017/03/image-name-1-300x180.jpg 300w, https://example.com/images/2017/03/image-name-1-768x460.jpg 768w, https://example.com/images/2017/03/image-name-1-825x493.jpg 825w, https://example.com/images/2017/03/image-name-1-410x246.jpg 410w, https://example.com/images/2017/03/image-name-1-150x90.jpg 150w" sizes="(max-width: 847px) 100vw, 847px">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>

现在,我的查询是;我如何转换<img><amp-img>

4

1 回答 1

-2

没有办法转换。您必须将 img 元素替换为 amp-img 元素。

并且您必须使用 amp-img 属性 src 和布局,相对于布局的宽度和高度。

于 2018-02-15T12:45:25.520 回答