<template>
  <div class="xd-title">
    <div class="xd-title-warper" :style="`min-width: ${width}px`">
      <div class="xd-top">
        <div class="xd-china" v-html="china"></div>
        <div v-if="engish" class="xd-engish" v-html="engish"></div>
      </div>
      <div class="xd-linebg" :style="`width: ${width}px;margin-left:-${width/2}px`"></div>
      <div class="xd-line"></div>
    </div>
  </div>
</template>

<script>
  /**
   * @description 中英文居中显示插件
   *
   * @property {Number} width 宽度 （选填） 默认：300
   * @property {String} china 中文标题 （选填） 默认：中国
   * @property {String} engish 英文标题 （选填） 默认：China
   */

  export default {
		name: "XdTitleChinaEnglish",
		props: {
		  width: {
		    type: Number,
        default: 300
      },
			china: {
				type: String,
				default: '中国'
			},
			engish: {
				type: String,
				default: 'China'
			}
		}
	}
</script>

<style scoped type="scss">
  .xd-title {
    width: 100%;
    text-align: center;
  }
  .xd-title-warper {
    display: inline-block;
    line-height: 72px;
    position: relative;
  }


  .xd-top {
    display: flex;
    flex-wrap: nowrap;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    font-size: 30px;
  }

  .xd-linebg {
    position: absolute;
    left: 50%;
    bottom: 0;
    height: 1px;
    background: #ccc;
    overflow: hidden;

  }
  .xd-china {
    color: #333;
    font-size: 30px;
  }

  .xd-engish {
    color: #8F8F8F;
    padding-left: 16px;
  }

  .xd-line {
    position: absolute;
    height: 5px;
    overflow: hidden;
    bottom: -2px;
    width: 26px;
    left: 50%;
    margin-left: -15px;
    background: #201d74;
  }

</style>
