12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <template>
- <view class="tm-avatarGroup">
- <view :class="[`pl-${posX}`]">
- <slot></slot>
-
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'tm-avatarGroup',
- props:{
- posX:{
- type:Number,
- default:30
- }
- },
- data() {
- return {
-
- };
- },
- mounted() {
- this.$nextTick(function(){
- this.inits();
- })
- },
- updated(){
- this.$nextTick(function () {
- this.inits();
- })
- },
- methods: {
- inits() {
- let t = this;
- let ch = [];
- // #ifndef H5
- ch = this.$children;
- // #endif
- // #ifdef H5
- ch = this.$children[0].$children[0].$children;
- // #endif
- ch.forEach((item, index) => {
- if (item.$options.name === 'tm-avatar') {
- item.setConfigStyle({
- 'margin-left':`-${t.posX}rpx`
- })
- }
- });
-
- }
- }
- };
- </script>
- <style lang="scss"></style>
|