123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <template>
- <view :style="viewColor">
- <view class='copy-list-window' :class='isCopy==true?"on":""'>
- <button class="iconfont icon-guanbi" @click='close'></button>
- <view class="title">
- <text class="iconfont icon-xuanzhong11"></text>
- {{title}}
- </view>
- <view class="copy-url">
-
- <text class="copy copy-data" :data-clipboard-text="copyUrl">{{copyUrl}}</text>
-
-
- <text>{{copyUrl}}</text>
-
- </view>
-
- <button class="button copy-data" :data-clipboard-text="copyUrl">点击复制口令</button>
-
-
- <button class="button" @click="copyText">点击复制口令</button>
-
- </view>
- <view class='mask' catchtouchmove="true" :hidden='isCopy==false' @click='close'></view>
- </view>
- </template>
- <script>
-
-
-
-
-
-
-
-
-
-
- import ClipboardJS from "@/plugin/clipboard/clipboard.js";
-
- import { mapGetters } from "vuex";
- export default {
- props: {
- isCopy: {
- type: Boolean,
- default: false,
- },
- copyUrl: {
- type: String,
- default: '',
- }
- },
- computed: mapGetters(['viewColor']),
- data() {
- return {
- title: '复制以下口令'
- };
- },
- mounted(){
- let that = this
-
- that.$nextTick(function() {
- var clipboard = new ClipboardJS('.copy-data');
- clipboard.on('success', function(e) {
- that.$util.Tips({
- title:'复制成功'
- })
- setTimeout(()=>{
- that.$emit('close');
- },500)
- });
- clipboard.on('error', function(e) {
- that.$util.Tips({
- title:'复制失败'
- })
- });
- });
-
- },
- methods: {
-
- copyText:function(){
- let that = this;
- uni.setClipboardData({ data: this.copyUrl });
- setTimeout(()=>{
- that.$emit('close');
- },500)
- },
-
- close: function(){
- this.$emit('close');
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .copy-list-window {
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- background-color: #fff;
- border-radius: 16rpx 16rpx 0 0;
- z-index: 555;
- transform: translate3d(0, 100%, 0);
- transition: all .1s cubic-bezier(.25, .5, .5, .9);
- padding: 50rpx 30rpx 30rpx;
- .icon-guanbi{
- position: absolute;
- top: 20rpx;
- right: 20rpx;
- color: #8A8A8A;
- }
- .button{
- height: 76rpx;
- border-radius: 38rpx;
- margin: 30rpx 30rpx 0;
- background-color: var(--view-theme);
- font-size: 30rpx;
- line-height: 76rpx;
- color: #FFFFFF;
- }
- }
- .copy-list-window.on {
- transform: translate3d(0, 0, 0);
- }
- .copy-list-window .title {
- width: 100%;
- text-align: center;
- font-size: 32rpx;
- font-weight: bold;
- font-family: 'PingFang SC';
- .iconfont {
- font-size: 30rpx;
- color: #FBB324;
- margin-right: 12rpx;
- }
- }
- .copy-url{
- margin-top: 30rpx;
- background: #F5F5F5;
- padding: 20rpx 25rpx;
- color: #BBBBBB;
- font-size: 28rpx;
- }
- </style>
|