baidu / baidu/san

暂不支持 sourceSlot+循环

Open
#504 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.7k
Forks
537
PR merge metrics
No merged PRs in 30d

Description

初始化 sourceSlot 的时候没有支持循环的情况:https://github.com/baidu/san/blob/master/src/view/component.js#L340

比如下面的代码:
```javascript
var Folder = san.defineComponent({
template: '

',
initData: function () {
return {repeat: [1,2]}
}
});

var MyComponent = san.defineComponent({
components: {
'x-folder': Folder
},

initData: function () {
return {repeat: [1,2]}
},

template: ''
+ '

'
+ '{{name}}'
+ '
'
});
```

这种写法的作用一般是为了给所有子节点的外层都套一层dom

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at src/view/component.js around line 340, where sourceSlot is initialized, and reproduce the issue with the Folder and MyComponent templates using s-for and generated slot names. Done means repeated child nodes using slots such as cc-1 and cc-2 render correctly inside their wrappers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.