支付宝小程序扩展组件 页脚·Footer

2020-09-18 11:19 更新

显示页面页脚组件。

扫码体验

示例代码

  1. {
  2. "defaultTitle": "Footer",
  3. "usingComponents": {
  4. "footer": "mini-ali-ui/es/footer/index"
  5. }
  6. }
  1. <footer
  2. type="{{footerInfo1.type}}"
  3. content="{{footerInfo1.content}}"
  4. />
  5. <footer
  6. type="{{footerInfo2.type}}"
  7. content="{{footerInfo2.content}}"
  8. extend="{{footerInfo2.extend}}"
  9. />
  10. <footer
  11. type="{{footerInfo3.type}}"
  12. content="{{footerInfo3.content}}"
  13. />
  14. <footer
  15. type="{{footerInfo4.type}}"
  16. content="{{footerInfo4.content}}"
  17. extend="{{footerInfo4.extend}}"
  18. onBrandTap="brandClick"
  19. />
  20. <footer
  21. type="{{footerInfo5.type}}"
  22. content="{{footerInfo5.content}}"
  23. extend="{{footerInfo5.extend}}"
  24. onBrandTap="brandClick"
  25. />
  26. <footer
  27. type="{{footerInfo6.type}}"
  28. content="{{footerInfo6.content}}"
  29. extend="{{footerInfo6.extend}}"
  30. />
  31. <footer
  32. type="{{footerInfo7.type}}"
  33. content="{{footerInfo7.content}}"
  34. footerEndColor="{{footerInfo7.footerEndColor}}"
  35. />
  36. <footer
  37. type="{{footerInfo8.type}}"
  38. />
  39. <footer
  40. type="{{footerInfo8.type}}"
  41. content="{{footerInfo8.content}}"
  42. showEndIcon="{{footerInfo8.showEndIcon}}"
  43. iconSize="{{footerInfo8.iconSize}}"
  44. />
  1. page {
  2. padding-top: 20px;
  3. background-color: #fff;
  4. }
  5. .am-footer {
  6. margin-bottom: 40px;
  7. }
  1. Page({
  2. data: {
  3. footerInfo1: {
  4. type: 'normal',
  5. content: '底部文案置底说明',
  6. },
  7. footerInfo2: {
  8. type: 'guide',
  9. content: '没找到需要的?搜一下试试',
  10. extend: [
  11. {
  12. link: '/pages/list/app',
  13. text: '蚂蚁借呗',
  14. },
  15. {
  16. link: '/pages/list/app',
  17. text: '备用金',
  18. },
  19. {
  20. link: '/pages/list/app',
  21. text: '花呗收钱',
  22. },
  23. ],
  24. },
  25. footerInfo3: {
  26. type: 'copyright',
  27. content: '© 2004-2020 Alipay.com. All rights reserved.',
  28. },
  29. footerInfo4: {
  30. type: 'brand',
  31. content: '过往业绩不预示产品未来表现,市场有风险,投资需谨慎',
  32. extend: [
  33. {
  34. logo: 'https://gw.alipayobjects.com/mdn/rms_ce4c6f/afts/img/A*XMCgSYx3f50AAAAAAAAAAABkARQnAQ',
  35. width: '30px',
  36. height: '30px',
  37. link: '/pages/list/app',
  38. },
  39. {
  40. logo: 'https://gw.alipayobjects.com/mdn/rms_ce4c6f/afts/img/A*gWo-TLFGp38AAAAAAAAAAABkARQnAQ',
  41. width: '420rpx',
  42. height: '116rpx',
  43. },
  44. ],
  45. },
  46. footerInfo5: {
  47. type: 'link',
  48. content: '© 2004-2020 Alipay.com. All rights reserved.',
  49. extend: [
  50. {
  51. link: '/pages/list/app',
  52. text: '底部链接',
  53. },
  54. ],
  55. },
  56. footerInfo6: {
  57. type: 'link',
  58. content: '© 2004-2020 Alipay.com. All rights reserved.',
  59. extend: [
  60. {
  61. link: '/pages/list/app',
  62. text: '底部链接',
  63. },
  64. {
  65. link: '/pages/list/app',
  66. text: '底部链接',
  67. },
  68. ],
  69. },
  70. footerInfo7: {
  71. type: 'end',
  72. content: '自定义的没有更多内容的底线',
  73. footerEndColor: 'red',
  74. },
  75. footerInfo8: {
  76. type: 'end',
  77. showEndIcon: true,
  78. iconSize: 50,
  79. },
  80. },
  81. brandClick() {
  82. my.alert({
  83. content: '这个品牌 logo 没有链接,可通过 js 自定义点击事件。',
  84. });
  85. },
  86. });

属性

属性 类型 默认值 描述 最低版本
className String - 自定义 class。 -
type String normal 选择使用指定的页脚类型。可选:normal、guide、copyright、brand、link、end。 1.0.4
content String - 页脚文本内容。 -
extend Array - 页脚部分的链接、logo 等信息。 -
onBrandTap EventHandle () => {} 品牌 logo 事件回调。 -
showEndIcon Boolean false type="end" 时的 footer 组件是否以 icon 方式展示,为 true 将不会显示 content 的文本内容。 1.0.4
iconName String selected 使用 am-icon,具体的值可参考 am-icon 的 type 值。 1.0.4
iconURL String - 使用网络图片。当确定使用网络图片后,iconName 将失效;且 网络图片目前仅支持宽高相同且小于等于 44rpx。 1.0.4
iconSize Number 18 小于等于 22px 的值。 1.0.4
footerEndColor String - type="end" 时文本的颜色。 1.0.4

Bug & Tip

  • onBrandTap 仅在 type: brand 中有效,且是无链接的品牌 logo;
  • 当选择不同的 type 时,extend 中的值也将会有所不同;
    • normal:无 extend;
    • guide:extend 的值为 [{ link: '', text: '',},]
    • copyright:无 extend;
    • brand:extend 的值为 [{ logo: '', width: '', height: '', link: '',},],如果无 link 的话,可选择触发 onBrandTap 事件;
    • link:extend 的值为 [{ link: '', text: '',},],但有多个值时,文本链接之间会有间隔线出现;
    • end:显示为“没有更多了”字样的结尾,可更改为 am-icon 中的类型或者自定图片 url;
    • end 类型 content 默认值为“没有更多了”;
    • showEndIcon 时,content 内容将不再显示;
    • iconURL 有值时,am-icon 中的类型将不会展示,显示为 icon 的 url,请确保该 url 是可访问的。
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号