vue 调用共众url

编程入门 行业动态 更新时间:2024-10-26 02:29:32

<a href=https://www.elefans.com/category/jswz/34/1770550.html style=vue 调用共众url"/>

vue 调用共众url

vue获得当前页面URL动态拼接URL复制邀请链接方法

当前页面完整url可以用 location.href

路由路径可以用 this.$route.path

路由路径参数 this.$route.params

实例:动态邀请链接,获得当前页面URL去掉path,替换成注册的加上邀请码:

this.invitelink = location.href.replace(this.$route.path,'') + "/register?invitecode=" + this.invitecode;

a标签的写法

这是一个动态链接

编辑

===============

复制邀请链接方法:

main.js里添加:

import VueClipboard from 'vue-clipboard2'

Vue.use(VueClipboard)

-----------

页面使用方法:

copyInvitelink(){var this_ = this;this.$copyText(this.invitelink).then(function(e) {

Toast.info(this_.$t("my.copedLink"));

},function(e) {

console.log(this_.$t("my.copeErr"));

}

);

},

更多推荐

vue 调用共众url

本文发布于:2024-03-07 19:20:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1718688.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:vue   url

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!