Skip to content

暂不支持 sourceSlot+循环 #504

@cxtom

Description

@cxtom

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

比如下面的代码:

var Folder = san.defineComponent({
  template: '<div><div s-for="i in repeat" class="slot-wrapper repeat-{{i}}"><slot name="cc-{{i}}"/></div></div>',
  initData: function () {
    return {repeat: [1,2]}
  }
});

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

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

  template: ''
    + '<div>'
    + '<x-folder hidden="{{folderHidden}}"><b s-for="i in repeat" slot="cc-{{i}}">{{name}}</b></x-folder>'
    + '</div>'
});

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions