New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
后续会支持外部class吗? #33
Comments
是指这个吗?使用外部样式 |
感谢您的回复,不是本地的wxss,是服务端的css,例如: |
如果用的是后端npm包的话是可以这样用link标签的(因为nodejs可以发起网络请求获取css的内容) |
可能我没描述清楚问题,我在服务端生成HTML,内容如下(服务器地址举例说明的,不是真实地址): |
是的,目前前端插件包对于 // 假设html是后台返回的字符串
var that = this;
// 获取css
var getStyle = function(html, links, i){
if(i>=0){
wx.request({
url: links[i].match(/href=['"](\S+?)['"]/)[1],
success(res){
getStyle("<style>"+res.data+"</style>"+html, links, i-1);
},
fail(err){
console.error(err);
}
})
} else {
that.setData({
html
})
}
}
// 获取link
var links = html.match(/<link.*?>/g);
if(links)
getStyle(html,links,links.length-1);
else {
that.setData({
html
})
} 虽然把 var parser = require("parser-wxapp");
return await parser(html); |
非常感谢您耐心的解答!我试一下您说的办法,我会推荐给其他朋友使用,谢谢! |
后续会支持外部class吗?
The text was updated successfully, but these errors were encountered: