vue 页面分享功能

    
    
      启用密码:

      

有效期限:
链接:


复制链接 打开链接
js: /* 分享方法 */ share () { if (this.bigSelectTree !== undefined&&this.bigSelectTree!==null) { this.shareDialogVisible = true } else { Message.warning("请选择分享的模板!") return } }, /* 复制功能 */ copyUrl () { var Url2 = document.getElementById("aaa") Url2.select() let aaas = document.execCommand("Copy") Message.success("复制成功,可粘贴!") this.shareDialogVisible = false }, /* 创建链接 */ shared () { if (this.bigSelectTree !== null) { this.createURL(this.bigSelectTree.id, "", "", this.bigScreenType) this.shareInfo.usePassword = "" this.shareInfo.password = "" this.shareInfo.useTime = "" this.shareCopyUrl = "" this.shareInfo.expiryTime = "" } return }, /* 总的分享链接 */ createURL (id, type) { let password = "" let expiryTime = "" var url = window.location.href var arrUrl = url.split("//") var start = arrUrl[1].indexOf("/") var relUrl = arrUrl[1].substring(0, start) if (this.shareInfo.usePassword) { password = this.shareInfo.password } else { password = "" } if (this.shareInfo.useTime) { expiryTime = this.dateToStr(this.shareInfo.expiryTime) } else { expiryTime = "" } let shareUrl = { id: id, type: this.bigScreenType } this.$http .post(url, {}).then(res => { this.shareCopyUrl = "http://" + relUrl + "id=" + res.data.data.linkInfoId this.shareDialogVisible=false this.appendDialog = true }) }, dateToStr(dateTime){ //获取日期的方法 }

 

你可能感兴趣的:(vue 页面分享功能)