<script src="js/clipboard.min.js"></script>vue
<button type="" class="code font80" :data-clipboard-text="InvitationCode">{{InvitationCode}}</button>
<p class="font24 share-click">點擊複製</p>this
////點擊複製url
var clipboard = new Clipboard('.code');
$(function() {
$(".code").click(function() {
$(".share-click").text('複製成功');
});
})插件
created: function () {
////給vue插件中的參數複製
this.InvitationCode = this.getQueryString("code");
},code
///截取url中的參數ip
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;
},get