Skip to content
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: add divider #785

Merged
merged 1 commit into from
Aug 12, 2023
Merged

feat: add divider #785

merged 1 commit into from
Aug 12, 2023

Conversation

GuYith
Copy link
Contributor

@GuYith GuYith commented Aug 12, 2023

add divider

当前遗留问题:

  • omi中如何获取组件的children?

  • (实现link的时候也有遇到该问题,使用 <slot> 变相实现)

  • OmiProps的属性中存在children,但是读取到的结果永远为null

@GuYith GuYith mentioned this pull request Aug 12, 2023
72 tasks
@tencent-adm
Copy link

tencent-adm commented Aug 12, 2023

CLA assistant check
All committers have signed the CLA.

@GuYith
Copy link
Contributor Author

GuYith commented Aug 12, 2023

好怪,已经签署过了

CLA assistant check Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.You have signed the CLA already but the status is still pending? Let us recheck it.

@dntzhang dntzhang merged commit e385843 into Tencent:master Aug 12, 2023
1 check was pending
@dntzhang
Copy link
Collaborator

@GuYith 使用jsx或者h的时候才能拿到 children

@dntzhang
Copy link
Collaborator

image

@dntzhang
Copy link
Collaborator

import { tag, WeElement, h } from 'omi'

@tag('my-counter')
class MyCounter extends WeElement {
  static css = `
    span{
      color: red;
    }`

  count = 1

  sub = () => {
    this.count--
    this.update()
  }

  add = () => {
    this.count++
    this.update()
  }

  render(props) {
    console.log(props.children)
    return (
      <>
        <button onClick={this.sub}>-</button>
        <span>{this.count}</span>
        <button onClick={this.add}>+</button>
      </>
    )
  }
}

@dntzhang
Copy link
Collaborator

import { render, h } from 'omi'
import './my-counter'

render((
  <div>
    <div>Component Demo</div>
    <my-counter >
      <span>aa</span>
      <span>bb</span>
    </my-counter>
  </div>
), 'body')

@dntzhang
Copy link
Collaborator

@GuYith 看上面的例子

@GuYith
Copy link
Contributor Author

GuYith commented Aug 13, 2023

好的好的,解决了。把propTypes中的children去掉后可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants