SOURCE

console 命令行工具 X clear

                    
>
console
var Main = {
    data() {
        return {
            str: ''
        }
    },
    methods: {
    },
    created() {
    },
    computed: {
        res() {
            let res = this.str && getRes(this.str);
            if (res) {
                copyToClip(res);
                this.$message('复制成功');
            }
            return res;
        }

    },
}
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')

function getRes(str) {
    let o = eval('a=' + str);
    let d = o.deliveryAddress, t = o.taxInvoice
    return `{
            "result": 1,
            "customerConfig": {
                "company_code": "${o.name}",
                "tax_recipient_short": "${o.name_zh}",
                "deliveryAddress": {
                    "firstName": "${d.firstName}",
                    "lastName": "${d.lastName}",
                    "line1": "${d.line1}",
                    "line2": "${d.line2}",
                    "townCity": "${d.townCity}",
                    "state": "${d.state}",
                    "postcode": "${d.postcode}",
                    "companyName": "${d.companyName}",
                    "companyUrl": "${d.companyUrl}",
                    "phoneNumber": "${d.phoneNumber}",
                    "email": "${d.email}
                }",
                "taxInvoice": {
                    "tax_recipient": "${t.recipient}",
                    "tax_RegistrationNumber": "${t.taxRegistrationNumber}",
                    "tax_registrationAddress": "${t.registrationAddress}",
                    "tax_phoneNumber": "${t.phoneNumber}",
                    "tax_bankName":"${t.bankName}",
                    "tax_bankAccountNo": "${t.bankAccountNo}",
                    "vatInvoiceAddress_firstName": "${t['vatInvoiceAddress.firstName']}",
                    "vatInvoiceAddress_companyName":"${t['vatInvoiceAddress.companyName']}",
                    "vatInvoiceAddress_phoneNumber": "${t['vatInvoiceAddress.phoneNumber']}",
                    "vatInvoiceAddress_line1": "${t['vatInvoiceAddress.line1']}",
                    "vatInvoiceAddress_townCity":  "${t['vatInvoiceAddress.townCity']}",
                    "vatInvoiceAddress_state": "${t['vatInvoiceAddress.state']}",
                    "vatInvoiceAddress_postcode": "${t['vatInvoiceAddress.postcode']}",
                    "email": "${t.email}",
                }
            }
        }`
}


function copyToClip(content, message = "复制成功") {
    var aux = document.createElement("textarea"); //或textarea
    aux.value = content;
    document.body.appendChild(aux);
    aux.select();
    document.execCommand("copy");
    document.body.removeChild(aux);
    //alert(message);
}
<div id="app">
	<el-container>
		<el-main>
			<el-row :gutter="20">
				<el-col :span="12">
					<div class="grid-content bg-purple">
						<el-input type="textarea" :rows="30" placeholder="请输入内容" v-model="str">
						</el-input>
					</div>
				</el-col>
				<el-col :span="12">
					<div class="grid-content bg-purple">
						<el-input type="textarea" :rows="30" placeholder="请输入内容" v-model="res">
						</el-input>
					</div>
				</el-col>
			</el-row>
		</el-main>
	</el-container>
</div>

本项目引用的自定义外部资源