AnchorNav 锚点导航

锚点导航容器组件。

基本用法

```schema: scope=”body” { “type”: “anchor-nav”, “links”: [ { “title”: “基本信息”, “body”: [ { “type”: “form”, “title”: “基本信息”, “body”: [ { “type”: “input-text”, “name”: “name”, “label”: “姓名:” }, { “name”: “email”, “type”: “input-email”, “label”: “邮箱:” } ] } ] }, { “title”: “工作信息”, “body”: [ { “type”: “form”, “title”: “工作信息”, “body”: [ { “type”: “input-text”, “name”: “cname”, “label”: “公司名称:” }, { “name”: “caddress”, “type”: “input-text”, “label”: “公司地址:” } ] } ] }, { “title”: “兴趣爱好”, “body”: [ { “type”: “form”, “title”: “兴趣爱好”, “body”: [ { “type”: “input-text”, “name”: “interest1”, “label”: “兴趣爱好1:” }, { “name”: “interest2”, “type”: “input-text”, “label”: “兴趣爱好2:” }, { “name”: “interest3”, “type”: “input-text”, “label”: “兴趣爱好3:” }, { “name”: “interest4”, “type”: “input-text”, “label”: “兴趣爱好4:” }, { “name”: “interest5”, “type”: “input-text”, “label”: “兴趣爱好5:” }, { “name”: “interest6”, “type”: “input-text”, “label”: “兴趣爱好6:” } ] } ] } ] }

  1. 默认想要显示多少锚点导航配置多少个 `links` 成员即可。
  2. ## 水平导航
  3. ```schema: scope="body"
  4. {
  5. "type": "anchor-nav",
  6. "direction": "horizontal",
  7. "links": [
  8. {
  9. "title": "基本信息",
  10. "body": [
  11. {
  12. "type": "form",
  13. "title": "基本信息",
  14. "body": [
  15. {
  16. "type": "input-text",
  17. "name": "name",
  18. "label": "姓名:"
  19. },
  20. {
  21. "name": "email",
  22. "type": "input-email",
  23. "label": "邮箱:"
  24. }
  25. ]
  26. }
  27. ]
  28. },
  29. {
  30. "title": "工作信息",
  31. "body": [
  32. {
  33. "type": "form",
  34. "title": "工作信息",
  35. "body": [
  36. {
  37. "type": "input-text",
  38. "name": "cname",
  39. "label": "公司名称:"
  40. },
  41. {
  42. "name": "caddress",
  43. "type": "input-text",
  44. "label": "公司地址:"
  45. }
  46. ]
  47. }
  48. ]
  49. },
  50. {
  51. "title": "兴趣爱好",
  52. "body": [
  53. {
  54. "type": "form",
  55. "title": "兴趣爱好",
  56. "body": [
  57. {
  58. "type": "input-text",
  59. "name": "interest1",
  60. "label": "兴趣爱好1:"
  61. },
  62. {
  63. "name": "interest2",
  64. "type": "input-text",
  65. "label": "兴趣爱好2:"
  66. },
  67. {
  68. "name": "interest3",
  69. "type": "input-text",
  70. "label": "兴趣爱好3:"
  71. },
  72. {
  73. "name": "interest4",
  74. "type": "input-text",
  75. "label": "兴趣爱好4:"
  76. },
  77. {
  78. "name": "interest5",
  79. "type": "input-text",
  80. "label": "兴趣爱好5:"
  81. },
  82. {
  83. "name": "interest6",
  84. "type": "input-text",
  85. "label": "兴趣爱好6:"
  86. }
  87. ]
  88. }
  89. ]
  90. }
  91. ]
  92. }

默认定位到某个区域

主要配置active属性来实现该效果,共有下面两种方法:

配置 href 值

```schema: scope=”body” { “type”: “anchor-nav”, “active”: “work”, “links”: [ { “title”: “基本信息”, “href”: “base”, “body”: [ { “type”: “form”, “title”: “基本信息”, “body”: [ { “type”: “input-text”, “name”: “name”, “label”: “姓名:” }, { “name”: “email”, “type”: “input-email”, “label”: “邮箱:” } ] } ] }, { “title”: “工作信息”, “href”: “work”, “body”: [ { “type”: “form”, “title”: “工作信息”, “body”: [ { “type”: “input-text”, “name”: “cname”, “label”: “公司名称:” }, { “name”: “caddress”, “type”: “input-text”, “label”: “公司地址:” } ] } ] }, { “title”: “兴趣爱好”, “href”: “interest”, “body”: [ { “type”: “form”, “title”: “兴趣爱好”, “body”: [ { “type”: “input-text”, “name”: “interest1”, “label”: “兴趣爱好1:” }, { “name”: “interest2”, “type”: “input-text”, “label”: “兴趣爱好2:” }, { “name”: “interest3”, “type”: “input-text”, “label”: “兴趣爱好3:” }, { “name”: “interest4”, “type”: “input-text”, “label”: “兴趣爱好4:” }, { “name”: “interest5”, “type”: “input-text”, “label”: “兴趣爱好5:” }, { “name”: “interest6”, “type”: “input-text”, “label”: “兴趣爱好6:” } ] } ] } ] }

  1. #### 配置索引值
  2. 单个`link`上不要配置`href`属性,配置需要展示的`link`索引值,`0`代表第一个。
  3. ```schema: scope="body"
  4. {
  5. "type": "anchor-nav",
  6. "active": 1,
  7. "links": [
  8. {
  9. "title": "基本信息",
  10. "body": [
  11. {
  12. "type": "form",
  13. "title": "基本信息",
  14. "body": [
  15. {
  16. "type": "input-text",
  17. "name": "name",
  18. "label": "姓名:"
  19. },
  20. {
  21. "name": "email",
  22. "type": "input-email",
  23. "label": "邮箱:"
  24. }
  25. ]
  26. }
  27. ]
  28. },
  29. {
  30. "title": "工作信息",
  31. "body": [
  32. {
  33. "type": "form",
  34. "title": "工作信息",
  35. "body": [
  36. {
  37. "type": "input-text",
  38. "name": "cname",
  39. "label": "公司名称:"
  40. },
  41. {
  42. "name": "caddress",
  43. "type": "input-text",
  44. "label": "公司地址:"
  45. }
  46. ]
  47. }
  48. ]
  49. },
  50. {
  51. "title": "兴趣爱好",
  52. "body": [
  53. {
  54. "type": "form",
  55. "title": "兴趣爱好",
  56. "body": [
  57. {
  58. "type": "input-text",
  59. "name": "interest1",
  60. "label": "兴趣爱好1:"
  61. },
  62. {
  63. "name": "interest2",
  64. "type": "input-text",
  65. "label": "兴趣爱好2:"
  66. },
  67. {
  68. "name": "interest3",
  69. "type": "input-text",
  70. "label": "兴趣爱好3:"
  71. },
  72. {
  73. "name": "interest4",
  74. "type": "input-text",
  75. "label": "兴趣爱好4:"
  76. },
  77. {
  78. "name": "interest5",
  79. "type": "input-text",
  80. "label": "兴趣爱好5:"
  81. },
  82. {
  83. "name": "interest6",
  84. "type": "input-text",
  85. "label": "兴趣爱好6:"
  86. }
  87. ]
  88. }
  89. ]
  90. }
  91. ]
  92. }

属性表

属性名 类型 默认值 说明
type string "anchor-nav" 指定为 AnchorNav 渲染器
className string 外层 Dom 的类名
linkClassName string 导航 Dom 的类名
sectionClassName string 锚点区域 Dom 的类名
links Array links 内容
direction string "vertical" 可以配置导航水平展示还是垂直展示。对应的配置项分别是:vertical、horizontal
active string 需要定位的区域
links[x].title string 区域 标题
links[x].href string 区域 标识
links[x].body SchemaNode 区域 内容区
links[x].className string "bg-white b-l b-r b-b wrapper-md" 区域成员 样式