Vue+intro.js超出两个引导隐藏跳过和上一步的按钮

今天给大家分享一下intro.js

1、安装 intro.js

npm install intro.js --save

2、在项目的 main.js 中,引入 intro.js 库和相关样式文件,如下:

import intro from 'intro.js' // introjs库

import 'intro.js/introjs.css' // introjs默认css样式

import 'intro.js/themes/introjs-modern.css' // introjs主题

效果图如下:

introOption: { // 参数对象
                prevLabel: '上一步',
                nextLabel: '下一步(1/2)',
                skipLabel: '跳过',
                doneLabel: '我知道了(2/2)',
                showBullets: false,
                showStepNumbers: false,
                exitOnEsc: false,
                exitOnOverlayClick: false,
                tooltipClass: 'duplicate-intro',
                steps: [],
          },
mounted() {
        this.$nextTick(() => {
            if(!store.get('QUESTION_IMPORT_INTRO')) {
                this.initGuide()
            }
        })
    },
 methods: {
     initGuide() {
                this.introOption.steps = [{
                    element: '.duplicate-question',
                    intro: '<p class="title cd-dark-major">题目导入</p><div class="cd-dark-minor cd-text-md">升级云能力可体验更强大的导入功能</div>',
                    position: 'bottom',
                },
                {
                    element: '.question-num',
                    intro: '<p class="title cd-dark-major">题目导入</p><div class="cd-dark-minor cd-text-md">升级云能力可体验更强大的导入功能</div>',
                    position: 'bottom',
                }],
                            
                    this.$intro()
                    .setOptions(this.introOption)
                    .start().onchange(function() {
                        document.querySelectorAll('.introjs-skipbutton')[0].style.display = 'inline-block'
                        document.querySelectorAll('.introjs-prevbutton')[0].style.display = 'none'
                        }).oncomplete(function() {
                        store.set('DUPLICATE_IMPORT_INTRO', true);
                    })
            },
    }
.duplicate-intro {

    padding: 20px;
    border-radius: 6px;

    .title {
        font-size: 16px;
        margin-bottom: 20px;
        font-weight: bolder;
    }

    .introjs-tooltip-header{
        padding-top: 20px;
    }

    .introjs-button:focus {
        outline: none;
        border: none;
        box-shadow: none;
      }

    .introjs-nextbutton {
        padding: 2px 16px;
        color: #fff;
        background: #46C37B;
        border: none;
        text-decoration: none;
        text-shadow: none;
        border-radius: 4px;
        color: #FFF;
        font-weight: 400;
        text-align: center;
        font-size: 14px;
        line-height: 22px; 
    }

    .introjs-skipbutton {
        padding: 2px 16px;
        color: #fff;
        background: #46C37B;
        border: none;
        text-decoration: none;
        text-shadow: none;
        border-radius: 4px;
        display: none;
        color: #FFF;
        font-weight: 400;
        text-align: center;
        font-size: 14px;
        line-height: 22px; 
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值