graceFaceGroup.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="grace-face-group" :style="{height:(size + borderWidth * 2 ) +'rpx'}">
  3. <view class="grace-face-items" v-if="isAddBtn"
  4. :style="{'z-index':startIndex, width:size+'rpx', height:size+'rpx', border:borderWidth + 'rpx solid ' + borderColor}"
  5. @tap.stop="addBtnClick">
  6. <slot></slot>
  7. </view>
  8. <view class="grace-face-items"
  9. v-for="(item, index) in items" :key="index"
  10. :style="{'z-index':startIndex - index - 1,
  11. left:isAddBtn ? (space * (index+1)) + 'rpx' : (space * index) + 'rpx',
  12. border:borderWidth + 'rpx solid ' + borderColor,
  13. width:size+'rpx', height:size+'rpx'}">
  14. <image :src="item" mode="widthFix"></image>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default{
  20. props:{
  21. items : {
  22. type : Array,
  23. default : function () {
  24. return new Array()
  25. }
  26. },
  27. size : {
  28. type : Number,
  29. default : 80
  30. },
  31. space : {
  32. type : Number,
  33. default : 60
  34. },
  35. borderWidth : {
  36. type : Number,
  37. default : 4
  38. },
  39. borderColor : {
  40. type : String,
  41. default : '#F5F5F5'
  42. },
  43. isAddBtn : {
  44. type : Boolean,
  45. default : false
  46. },
  47. startIndex : {type:Number, default:100}
  48. },
  49. methods:{
  50. addBtnClick : function () {
  51. this.$emit('addBtnClicked');
  52. }
  53. }
  54. }
  55. </script>
  56. <style scoped>
  57. .grace-face-group{position:relative;}
  58. .grace-face-items{width:100rpx; height:100rpx; position:absolute; overflow:hidden; border-radius:100%;}
  59. .grace-face-items image{width:100%;}
  60. </style>