my-fab.uvue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view>
  3. <uni-fab ref="fab" :pattern="pattern" :content="content" :horizontal="horizontal" :vertical="vertical"
  4. :direction="direction" @trigger="trigger" @fabClick="fabClick" />
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. data() {
  10. return {
  11. horizontal: 'right',
  12. vertical: 'top',
  13. direction: 'horizontal',
  14. pattern: {
  15. color: '#7A7E83',
  16. backgroundColor: '#fff',
  17. selectedColor: '#007AFF',
  18. buttonColor: '#c5c5c5',
  19. iconColor: '#fff',
  20. icon: 'closeempty'
  21. },
  22. content: [
  23. /* {
  24. iconPath: '/static/image.png',
  25. selectedIconPath: '/static/image-active.png',
  26. text: '相册',
  27. active: false
  28. },
  29. {
  30. iconPath: '/static/home.png',
  31. selectedIconPath: '/static/home-active.png',
  32. text: '首页',
  33. active: false
  34. },
  35. {
  36. iconPath: '/static/star.png',
  37. selectedIconPath: '/static/star-active.png',
  38. text: '收藏',
  39. active: false
  40. } */
  41. ]
  42. }
  43. },
  44. methods: {
  45. trigger(e) {
  46. /* console.log(e)
  47. this.content[e.index].active = !e.item.active
  48. uni.showModal({
  49. title: '提示',
  50. content: `您${this.content[e.index].active ? '选中了' : '取消了'}${e.item.text}`,
  51. success: function (res) {
  52. if (res.confirm) {
  53. console.log('用户点击确定')
  54. } else if (res.cancel) {
  55. console.log('用户点击取消')
  56. }
  57. }
  58. }) */
  59. },
  60. fabClick() {
  61. window.location.href = 'action://to_home/';
  62. /* uni.showToast({
  63. title: '点击了悬浮按钮',
  64. icon: 'none'
  65. }) */
  66. },
  67. }
  68. }
  69. </script>
  70. <style>
  71. /deep/ .uni-fab__circle {
  72. opacity: 60%;
  73. width: 35px;
  74. height: 35px;
  75. }
  76. /deep/ .fab-circle-icon {
  77. font-size: 20px !important;
  78. }
  79. </style>