<!-- CopyRight (C) 2017-2022 Alibaba Group Holding Limited. -->
<!-- Created by Tw93 on 17/07/28. -->

<template>
  <div @click="onLinkClick">
    <lc-rich-text-text
      :text-value="linkValue"
      :has-text-margin="hasTextMargin"
      :text-style="linkStyle?linkStyle:defObj"
      :text-theme="linkTheme?linkTheme:'black'"></lc-rich-text-text>
  </div>
</template>

<script>
  import Utils from '../utils';
  import LcRichTextText from './lc-rich-text-text.vue'
  import Light from 'light'

  export default {
    components: { LcRichTextText },
    props: {
      linkValue: {
        type: [String, Number],
        default: ''
      },
      hasTextMargin: {
        type: Boolean,
        default: true
      },
      linkHref: {
        type: String,
        default: ''
      },
      linkTheme: {
        type: String,
        default: 'black'
      },
      linkStyle: {
        type: Object,
        default: () => ({})
      }
    },
    data: () => ({
      defObj: {}
    }),
    methods: {
      onLinkClick (e) {
        const self = this;
        // 210687 【TS:202005251022-平台业委会(云基础)_郭凌波-light-ui h51、richtext的LcRi】
        // Utils.goToH5Page(self.linkHref);
        Light.navigate(self.linkHref)
        self.$emit('LcRichTextLinkClick', { element: e, href: self.linkHref });
      }
    }
  };
</script>
