/**
 * tdesign v0.32.0
 * (c) 2021 tdesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import Vue from 'vue';
import { FileCopyIcon } from 'tdesign-icons-vue';
import copyText from '../utils/clipboard.js';
import { MessagePlugin } from '../message/plugin.js';
import props from './anchor-target-props.js';
import { Popup } from '../popup/index.js';
import { COMPONENT_NAME } from './constant.js';
import 'clipboard';
import '@babel/runtime/helpers/typeof';
import '../message/messageList.js';
import '../message/const.js';
import '../message/message.js';
import '../loading/index.js';
import '../loading/loading.js';
import '../loading/icon/gradient.js';
import '../config.js';
import '../utils/set-style.js';
import '../utils/classnames.js';
import '../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../utils/easing.js';
import '../utils/render-tnode.js';
import '../utils/transfer-dom.js';
import '../loading/props.js';
import '../utils/withInstall.js';
import 'lodash/capitalize';
import './style/css.js';
import '../loading/type.js';
import '../loading/plugin.js';
import '../message/props.js';
import '../popup/popup.js';
import '@popperjs/core';
import '../_chunks/dep-1db5c91c.js';
import '../popup/props.js';
import '../utils/map-props.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '../popup/type.js';

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var _AnchorTarget = Vue.extend({
  name: "TAnchorTarget",
  components: {
    TPopup: Popup,
    FileCopyIcon: FileCopyIcon
  },
  props: _objectSpread({}, props),
  methods: {
    copyText: function copyText$1() {
      var a = document.createElement("a");
      a.href = "#".concat(this.id);

      copyText(a.href);

      MessagePlugin.success("\u94FE\u63A5\u590D\u5236\u6210\u529F", 1e3);
    }
  },
  render: function render() {
    var h = arguments[0];
    var Tag = this.tag,
        children = this.$scopedSlots["default"],
        id = this.id;
    var className = ["".concat(COMPONENT_NAME, "__target")];
    var iconClassName = "".concat(COMPONENT_NAME, "__copy");
    return h(Tag, {
      "attrs": {
        "id": id
      },
      "class": className
    }, [children && children(null), h("t-popup", {
      "attrs": {
        "content": "\u590D\u5236\u94FE\u63A5",
        "placement": "top",
        "showArrow": true
      },
      "class": iconClassName
    }, [h("file-copy-icon", {
      "nativeOn": {
        "click": this.copyText
      }
    })])]);
  }
});

export { _AnchorTarget as default };
//# sourceMappingURL=anchor-target.js.map
