123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <template>
- <div class="intro brightness" v-clickoutside="handleoutside" @touchmove.stop>
- <div v-if="!istips">
- <p>分享链接给好友</p>
- <div class="link" v-html="url"></div>
- <div class="btn">
- <span
- @click.stop="$emit('close')"
- >
- 取消
- </span>
- <span ref="btn" class="submit" :data-clipboard-text="url">
- 一键复制
- </span>
- </div>
- <img
- class="close"
- @click.stop="$emit('close')"
- :src="require('@/assets/images/close.png')"
- />
- </div>
- <transition name="fade">
- <div class="tips" v-if="istips">
- 场景链接复制成功
- </div>
- </transition>
- </div>
- </template>
- <script>
- export default {
- methods: {
- handleoutside() {
- this.$emit("close");
- },
- },
- mounted() {
- let copy = new window.ClipboardJS(this.$refs.btn);
- copy.on("success", (e) => {
- this.istips = true
- setTimeout(() => {
- this.istips = false
- this.$emit('close')
- }, 3000);
- e.clearSelection();
- });
- copy.on("error", (err) => console.log(err));
- },
- data() {
- return {
- url: window.location.href.replace('http://','https://'),
- istips:false
- };
- }
- };
- </script>
- <style lang="less" scoped>
- @bx: 0 3px 6px rgba(0, 0, 0, 1);
- @bc: rgba(12, 91, 246, 0.8);
- @animation: 0.3s ease all;
- .intro {
- text-align: center;
- width: 100%;
- height: 100%;
- position: fixed;
- top: 0;
- left: 0;
- > div {
- padding: 10px;
- width: 90%;
- transform: translate(-50%, -50%);
- top: 50%;
- left: 50%;
- position: fixed;
- background-color: rgba(0, 0, 0, 0.5);
- border-radius: 10px;
- box-sizing: content-box;
- > p {
- text-align: left;
- }
- .link {
- color: #fff;
- text-align: center;
- padding: 10px 30px;
- word-wrap: break-word;
- line-height: 1.5;
- margin: 20px 0;
- background-color: rgba(0, 0, 0, 0.35);
- }
- .btn{
- width: 100%;
- display: flex;
- justify-content: space-around;
- align-items: center;
- margin-bottom: 20px;
- >span{
- color: #fff;
- border: 1px solid #ccc;
- background-color: transparent;
- border-radius: 30px;
- width: 40%;
- height: 40px;
- line-height: 40px;
- }
- .submit{
- background-color: @color;
- border: 1px solid @color;
- }
- }
- .close {
- position: absolute;
- bottom: -18px;
- width: 36px;
- padding: 8px;
- left: 50%;
- transform: translateX(-50%);
- border-radius: 30px;
- box-shadow: @bx;
- background-color: @bc;
- }
- }
- .tips{
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%,-50%);
- width: 50%;
- padding: 20px 10px;
- }
- }
- </style>
|