import '../AddInterface.scss' import React, { Component } from 'react' import { Button, message } from 'antd' import Clipboard from 'clipboard' import PropTypes from 'prop-types' const success = () => { message.success('复制成功!') } class MockUrl extends Component { static propTypes = { mockURL: PropTypes.string } constructor(props) { super(props) } componentDidMount () { setTimeout(this.clipboard, 500) } clipboard () { const btn = document.querySelector('#mock-clipboard') const txt = document.querySelector('#mock-p').innerHTML new Clipboard(btn, { text: () => txt, target () { success() } }) } render () { return (
mock地址 :

{this.props.mockURL}

请配置host ***.***.***.*** www.xxx.com
) } } export default MockUrl