Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

将一段html页面中的代码内容存入数据库,希望从数据库提取数据后,可以变成我想要的样子

<br/>import&nbsp;fs&nbsp;from&nbsp;'fs'<br/>import&nbsp;{default&nbsp;as&nbsp;fs}&nbsp;from&nbsp;'fs'<br/>import&nbsp;*&nbsp;as&nbsp;fs&nbsp;from&nbsp;'fs'<br/>import&nbsp;{readFile}&nbsp;from&nbsp;'fs'<br/>import&nbsp;{readFile&nbsp;as&nbsp;read}&nbsp;from&nbsp;'fs'<br/>import&nbsp;fs,&nbsp;{readFile}&nbsp;from&nbsp;'fs'<br/><br/>export&nbsp;default&nbsp;fs<br/>export&nbsp;const&nbsp;fs<br/>export&nbsp;function&nbsp;readFile<br/>export&nbsp;{readFile,&nbsp;read}<br/>export&nbsp;*&nbsp;from&nbsp;'fs'<br/><br/>

我从数据库提取出数据后变成这种格式,请问怎么实现?

<pre><code>
import fs from 'fs'
import {default as fs} from 'fs'
import * as fs from 'fs'
import {readFile} from 'fs'
import {readFile as read} from 'fs'
import fs, {readFile} from 'fs'
</pre></code>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

直接用innerHTML输出就好了呀

image.png

如果你是需要改变标签的话,那么你直接去把br标签替换掉,然后外面包裹一下就OK了


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...