-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: support attr inherit #170
Conversation
src/runtime/underscore.ts
Outdated
* @param attrs 上层透传接收的属性 | ||
* @param props 传递的props | ||
*/ | ||
function deleteAttrByProps (attrs: string[], props: Record<string, number>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议写成纯函数,返回一个新的数组
src/ast/renderer-ast-dfn.ts
Outdated
@@ -318,7 +318,7 @@ export class HelperCall implements SyntaxNode { | |||
public readonly kind = SyntaxKind.HelperCall | |||
constructor ( | |||
public name: 'styleFilter' | 'classFilter' | 'xstyleFilter' | 'xclassFilter' | 'attrFilter' | 'boolAttrFilter' | | |||
'output' | 'escapeHTML', | |||
'output' | 'escapeHTML' | 'deleteAttrByProps' | 'mergeAttr', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里没有删干净 'deleteAttrByProps' | 'mergeAttr'
src/runtime/underscore.ts
Outdated
@@ -16,6 +16,11 @@ export interface Context { | |||
instance: any | |||
} | |||
|
|||
interface NewAttr { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
干掉不用的 interface
if (Object.keys(propsAttrAssign).length) { | ||
rootAttrExec.push(...[ | ||
DEF('propsAttr', new MapLiteral(Object.keys(propsAttrAssign).map(name => [I(name), I('1')]))), | ||
new Foreach(I('key'), I('val'), I('attrs'), [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需不需要考虑变量冲突问题?
🎉 This PR is included in version 3.14.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [3.14.0](baidu/san-ssr@nv3.13.3...nv3.14.0) (2024-01-23) ### Features * support attr inherit ([baidu#170](baidu#170)) ([221c90b](baidu@221c90b)) * support attr inherit ([baidu#171](baidu#171)) ([5ddd882](baidu@5ddd882))
baidu/san#772