<script src="js/clipboard.min.js"></script>
<button type="" class="code font80" :data-clipboard-text="InvitationCode">{{InvitationCode}}</button>
<p class="font24 share-click">点击复制</p>
////点击复制
var clipboard = new Clipboard('.code');
$(function() {
$(".code").click(function() {
$(".share-click").text('复制成功');
});
})
created: function () {
////给vue插件中的参数复制
this.InvitationCode = this.getQueryString("code");
},
///截取url中的参数
getQueryString: function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
},