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

[请教问题] text 类的field 是否有自定义 render 的能力? #104

Open
ly525 opened this issue Jan 7, 2020 · 2 comments
Open

Comments

@ly525
Copy link
Contributor

ly525 commented Jan 7, 2020

比如某个 table 中的某个字段叫 diff (意思是昨天的收入和今天的对比),类似股票的涨跌幅一样

image

fields: {
  diff: {
    type: 'text',
    label: '收入对比',
    // 【这里是否有类似 render 的功能】
    // 【fieldValue 涨跌幅的数值】
    render(rowData, fileldValue, field) {
      return fieldValue > 0 ?
      <span style="color: red;">+{{ fieldValue}}</span> :
      <span style="color: green;">-{{fieldValue}}</span> : 
    }

  }

}
@EdwardQ
Copy link

EdwardQ commented Jan 7, 2020

fields: {
  diff: {
    type: 'html',
    label: '收入对比',
    // 【这里是否有类似 render 的功能】
    // 【fieldValue 涨跌幅的数值】
    view(fileldValue, field) {
      return fieldValue > 0 ?
      <span style="color: red;">+{{ fieldValue}}</span> :
      <span style="color: green;">-{{fieldValue}}</span> : 
    }
  }
}

@ly525
Copy link
Contributor Author

ly525 commented Jan 7, 2020

@EdwardQ 那等 <ams-field-html-view> 这个组件上线了之后,我再来关闭 issue 吧,感谢!

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

No branches or pull requests

2 participants