PopOver 弹出提示

popover 不是一个独立组件,它是嵌入到其它组件中使用的,目前可以在以下组件中配置

  • table 的 column
  • list 的 column
  • static
  • cards 里的字段

基本配置

比如在 CRUD 的 tpl 中,可以默认截断显示,然后加上 popOver 来显示全部内容

```schema: scope=”body” { “type”: “crud”, “api”: “/api/mock2/sample?waitSeconds=1”, “columns”: [ { “type”: “tpl”, “name”: “engine”, “label”: “Rendering engine”, “tpl”: “${engine|truncate:6}”, “popOver”: “${engine}” } ] }

  1. > 上面的 popOver 精简写法只支持 1.6.5 及以上版本,之前版本需要使用 "popOver": {"body": "$engine"}
  2. ## 在其它组件里的示例
  3. ```schema: scope="body"
  4. [
  5. {
  6. "type": "form",
  7. "body": [
  8. {
  9. "name": "static",
  10. "type": "static",
  11. "label": "静态展示",
  12. "value": "static",
  13. "popOver": "弹出内容"
  14. }
  15. ]
  16. },
  17. {
  18. "type": "service",
  19. "api": "/api/mock2/sample?perPage=5",
  20. "body": [
  21. {
  22. "type": "list",
  23. "source": "$rows",
  24. "listItem": {
  25. "body": [
  26. {
  27. "type": "hbox",
  28. "columns": [
  29. {
  30. "label": "Engine",
  31. "name": "engine",
  32. "popOver": "弹出内容"
  33. }
  34. ]
  35. }
  36. ]
  37. }
  38. }
  39. ]
  40. },
  41. {
  42. "type": "service",
  43. "api": "/api/mock2/sample?perPage=5",
  44. "body": {
  45. "type": "cards",
  46. "source": "$rows",
  47. "card": {
  48. "body": [
  49. {
  50. "label": "Engine",
  51. "name": "engine",
  52. "popOver": "弹出内容"
  53. }
  54. ]
  55. }
  56. }
  57. }
  58. ]

更多配置

可以配置触发条件,是否显示 icon,title 等,具体请参考后面的配置列表

```schema: scope=”body” { “type”: “crud”, “api”: “/api/mock2/sample?waitSeconds=1”, “columns”: [ { “type”: “tpl”, “name”: “engine”, “label”: “Rendering engine”, “tpl”: “${engine|truncate:6}”, “popOver”: { “trigger”: “hover”, “position”: “left-top”, “showIcon”: false, “title”: “标题”, “body”: { “type”: “tpl”, “tpl”: “${engine}” } } } ] }

  1. ## popOverEnableOn
  2. 可以给列上配置`popOverEnableOn`属性,该属性为[表达式](../../docs/concepts/expression),通过[表达式](../../docs/concepts/expression)配置当前行是否启动`popOver`功能
  3. ```schema: scope="body"
  4. {
  5. "type": "crud",
  6. "api": "/api/mock2/sample?waitSeconds=1",
  7. "columns": [
  8. {
  9. "name": "id",
  10. "label": "ID",
  11. "popOver": {
  12. "body": {
  13. "type": "tpl",
  14. "tpl": "${id}"
  15. }
  16. },
  17. "popOverEnableOn": "this.id == 1"
  18. },
  19. {
  20. "name": "engine",
  21. "label": "Rendering engine",
  22. "popOver": {
  23. "body": {
  24. "type": "tpl",
  25. "tpl": "${engine}"
  26. }
  27. }
  28. }
  29. ]
  30. }

属性列表

  • mode 可配置成 popOverdialog 或者 drawer。 默认为 popOver
  • size 当配置成 dialog 或者 drawer 的时候有用。
  • position 配置弹出位置,只有 popOver 模式有用,默认是自适应。 可选参数:

    • center
    • left-top
    • right-top
    • left-bottom
    • right-bottom

    atX-atY-myX-myY 即:对齐目标的位置-对齐自己的位置

    • left-top-right-bottom 在目标位置的左上角显示。
    • left-center-right-center 在目标的左侧显示,垂直对齐。

    固定位置

    • fixed-center
    • fixed-left-top
    • fixed-right-top
    • fixed-left-bottom
    • fixed-right-bottom
  • offset 默认 {top: 0, left: 0},如果要来一定的偏移请设置这个。

  • trigger 触发弹出的条件。可配置为 click 或者 hover。默认为 click
  • showIcon 是否显示图标。默认会有个放大形状的图标出现在列里面。如果配置成 false,则触发事件出现在列上就会触发弹出。
  • title 弹出框的标题。
  • body 弹出框的内容。