<template>
  <div class="th-service-panel">
    <div class="label">
      URL:
      <Input
        v-model="currentUrl"
        type="textarea"
        :rows="1"
        @on-change="urlChange"
      />
    </div>
    <div class="label">
      示例:
      <div>
        <code
          >https://t0.tianditu.gov.cn/DataServer?T=img_c&x={x}&y={y}&l={z}&tk=caa3f753216b87bf4bd6cca1ef6feb4f</code
        >
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    url: {
      type: String,
      default: '',
    },
    type: {
      type: String,
      default: '',
    },
  },
  mounted() {
    this.currentUrl = this.type==='service'?this.url || '':''
  },
  methods: {
    urlChange() {
      this.$emit('on-change', this.currentUrl)
    },
  },
  data() {
    return {
      currentUrl: '',
    }
  },
  watch: {
    url() {
      this.currentUrl = this.url
    },
  },
}
</script>
