提交 b6449e76 编写于 作者: Q qiang

fix: 解决 scope-slot 中定义的 class 样式不生效的问题 question/100724 (+1 squashed commit)

Squashed commits:
[2a9e362bd] fix: 解决 scope-slot 中定义的 class 样式不生效的问题 question/100724
上级 c0849d59
......@@ -12,6 +12,12 @@ wx.createComponent({
`
}
function generateCssCode (ownerName) {
return `
@import './${ownerName}.wxss'
`
}
function hasOwn (obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key)
}
......@@ -61,7 +67,7 @@ module.exports = {
}
parentNode.attr.generic[slotName] = true
// 生成 scopedSlots 文件,包括 json,js,wxml,还需要更新 owner 的 usingComponents
// 生成 scopedSlots 文件,包括 json,js,wxml,wxss,还需要更新 owner 的 usingComponents
if (!state.files) {
state.files = {}
}
......@@ -100,6 +106,11 @@ module.exports = {
const jsContent = generateJsCode(genCode(t.objectExpression(objectProperties), true))
state.files[jsFile] = jsContent
const cssFile = resourcePath.replace(ownerName + extname, componentName + '.wxss')
const cssContent = generateCssCode(ownerName)
state.files[cssFile] = cssContent
if (!state.generic) {
state.generic = []
}
......@@ -108,4 +119,4 @@ module.exports = {
return ''
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册