0.0.7 • Published 1 year ago

driver-any v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

👨介绍/Why

🚀 Driver-any能够帮助你更加快速的自定义化的为你页面中添加引导步骤, 只需简单的配置步骤即可呈现想要的引导用户快速使用网站的效果.

💻使用/Use

引入样式文件

⭐ 在使用前你应该及时的引用来自Driver-any的样式文件, 该文件中涵盖着默认引导步骤所需要的样式.

import "driver-any/dist/index.css"
使用Driver-any
🚀 简单使用
import "driver-any/dist/index.css"
import { DriverAny } from "driver-any";

// 通过driver包中导出的DriverAny类产生一个实例
const driver = new DriverAny();

// 自定义引导步骤的每一步
driver.configurationSteps([{
    domSelector: "#step1", // 该步骤所引导的元素的选择器
    stepDesc: "This is the descriptor for step one", // 该步骤的步骤描述
    pushComponentPosition: "top" 
}, {
    domSelector: "#step2",
    stepDesc: "This is the descriptor for step two",
    pushComponentPosition: "right"
}]);

// 最后启动我们设定好的引导步骤
driver.start();
🏂 更加自由的使用
import { DriverAny } from "driver-any";

// 通过driver包中导出的DriverAny类产生一个实例
const driver = new DriverAny({
    pushComponentPosition: "top", // 默认步骤推动元素位于引导元素的哪个方位
    ifUsePushComponent: true, // 是否使用自己所编写的引导步骤元素
    ifClickMaskCloseStep: false, // 点击遮罩层是否可关闭
    animation: true, // 动画过渡效果
    onCloseCallback: () => {console.log("close");}, // 引导步骤关闭时触发的回调函数
    onFinishCallback: () => {console.log("finish");}, // 引导步骤完成时触发的回调函数
    onNextCallback: (item) => {console.log("下一步", item);}, // 引导步骤的下一步触发时触发的回调函数
    onPrevCallback: (item) => {console.log("上一步", item);}, // 引导步骤的上一步触发时触发的回调函数
});

// 自定义引导步骤的每一步
driver.configurationSteps([{
    domSelector: "#step1", // 该步骤所引导的元素的选择器
    stepDesc: "This is the descriptor for step one", // 该步骤引导的描述语
    customizedPushComponent: "#step1-form",// 使用自己所书写的推动引导步骤的元素的选择器
    pushComponentPosition: "top" // 该步骤元素位于引导元素的哪个方位
}, {
    domSelector: "#step2",
    stepDesc: "This is the descriptor for step two",
    customizedPushComponent: "#step2-form",
    pushComponentPosition: "right"
}]);

// 最后启动我们设定好的引导步骤
driver.start();

参数/Params

DriverAny
名称注解类型默认值
maskClass自定义遮罩层class名string | undefined""
maskZIndex自定义遮罩层z-indexnumber100
selectClass自定义选中元素背景板class名string | undefined""
selectPadding自定义选中元素背景板paddingnumber5
ifUsePushComponent是否采用默认推动组件状态booleantrue
pushComponentPosition提示推动下一步引导步骤的状态组件位置"top" | "right" | "bottom" | "left""bottom"
closeButtonText关闭按钮的按钮文本string | undefined"关闭"
nextButtonText下一步按钮的按钮文本string | undefined"下一步"
prevButtonText上一步按钮的按钮文本string | undefined"上一步"
finishButtonText完成按钮的按钮文本string | undefined"完成"
ifShowCloseButton是否展示关闭按钮boolean | undefinedfalse
ifShowNextButton是否展示下一步按钮boolean | undefinedtrue
ifShowPrevButton是否展示上一步按钮boolean | undefinedfalse
animation是否开启动画效果boolean | undefinedtrue
pushComponentClass自定义推送状态组件的描述文本class名string | undefined""
ifClickMaskCloseStep点击遮罩层是否可关闭引导boolean | undefinedtrue
ifScrollPageWhenStepStart引导步骤时是否允许页面滚动(暂时只支持禁止滚动)booleanfalse
onNextCallback引导步骤触发下一步时触发的回调函数(step: IDriverStepConfig) => void | undefined() => {}
onPrevCallback引导步骤触发上一步时触发的回调函数(step: IDriverStepConfig) => void | undefined() => {}
onFinishCallback引导步骤触发完成时触发的回调函数() => void | undefined() => {}
onCloseCallback引导步骤触发关闭时触发的回调函数() => void | undefined() => {}

📚 更多功能, 敬请期待...

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago