<style lang="less" scoped>
.has-person {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 24rpx;
    height: 36rpx;
    width: 92rpx;
    border-radius: 24rpx;
    background: rgba(0, 0, 0, 0.16);
    padding: 0px 8rpx 0px 8rpx;
    .img-box {
        height: 32rpx;
        width: 32rpx;
    }
    .text-box {
        margin-left: 4rpx;
        font-family: PingFang SC;
        font-size: 22rpx;
        font-weight: 500;
        line-height: 36rpx;
        color: rgba(255, 255, 255, 1);;
        .notHas {
            color: rgba(255, 255, 255, 1);
        }
    }
}
</style>

<template>
    <div class="has-person">
        <image
            lazyload
            class="img-box"
            :src="imgType"
        />
        <div
            class="text-box"
            :class="{'notHas': !isPassengerPass}"
        >
            <span>{{isPassengerPass?'有人':'无人'}} </span>
        </div>
    </div>
</template>
<script>
import wepy from '@wepy/core'
import config from '@/config'

wepy.component({
  props: {
    isPassengerPass: Boolean
  },
  data: {
    h5StaticPath: config.h5StaticPath + '/page-officehome/',
    imgType: ''
  },
  watch: {
    isPassengerPass: {
      handler(val) {
        this.imgType = val ? `${this.h5StaticPath}has_person.svg` : `${this.h5StaticPath}not_has_person.svg`
      },
      immediate: true
    }

  }
})
</script>
