我的样式是从后台动态获取,前端进行渲染的,核心代码如下
const style = `
.vue-preview .text {
color: #4fc08d;
}`
this.styleEl = document.createElement('style')
this.styleEl.type = 'text/css'
this.styleEl.innerHTML = style;
document.getElementsByTagName('head').item(0).appendChild(this.styleEl)
本文介绍了一种从前端动态获取样式并进行渲染的方法。通过创建 style 元素并将其添加到页面中,可以实现样式动态更新的功能。
231

被折叠的 条评论
为什么被折叠?



