gui-face-group.vue 1.7 KB

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