1.0.5 • Published 1 year ago

guide-canvas v1.0.5

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

guide

介绍

web guide,网页指引、提示。页面无滚动条时使用最佳。

效果图

image

Vue中使用

1 下载依赖:

npm i guide-canvas -S

2 在vue文件中使用

  import guideCanvas from "guide-canvas";
  mounted() {
    let cc= document.getElementById('cc');
    let stepArr=[
      {
        el: cc,
        text: {
          fontSize: 16,
          color:'red',
          message: "内容内容aaaaaaaaaa",
          position: [400, 699],
          maxWidth: 200,
        },
        button: {
          message: "下一步",
        },
      },
      {
        el: cc,
        text: {
          fontSize: 16,
          color:'red',
          message: "内容内容aaaaaaaaaa",
          position: [400, 599],
          maxWidth: 200,
        },
        button: {
          message: "下一步",
        },
      },
      {
        el: cc,
        text: {
          fontSize: 16,
          color:'red',
          message: "内容内容aaaaaaaaaa",
          position: [400, 499],
          maxWidth: 200,
        },
        button: {
          message: "下一步",
        },
      },
      {
        el: cc,
        text: {
          fontSize: 16,
          color:'red',
          message: "内容内容aaaaaaaaaa",
          position: [400, 399],
          maxWidth: 200,
        },
        button: {
          message: "完成",
        },
      }
    ]
    guideCanvas(stepArr,()=>{
      console.log('指引结束后的回调')
    });
  }

html中使用

<script src="https://github.com/wdhcgp/guide-canvas/blob/main/dist/guideCanvas.min.js"></script>
<script>
    window.onload=()=>{
        let round1=document.getElementsByClassName('round1')[0]
        let rect=document.getElementsByClassName('rect')[0]
        let rect2=document.getElementsByClassName('rect2')[0]
        let stepsArr=[
      {
        el: round1,
        shape:'round',
        text: {
          fontSize: 16,
          message: "内容内容提示提示提示提示提示提示提示,内容内容提示提示提示提示提示提示提示,内容内容提示提示提示提示提示提示提示,内容内容提示提示提示提示提示提示提示,",
          position: [810, 200],
          maxWidth: 200,
        }
      },
      {
        el: round1,
        text: {
          fontSize:25,
          lineHeight:30,
          color:'#fff',
          message: "内容内容提示提示提示提示提示提示提示,内容内容提示提示提示提示提示提示提示,内容内容提示提示提示提示提示提示提示,内容内容提示提示提示提示提示提示提示,",
          position: [810, 200],
          maxWidth: 200,
        },
        button: {
          fontSize: 26,
          color:'black',
          message: "第一步",
          width: 200,
          height: 70,
        },
      },
      {
        el: rect,
        text: {
          fontSize: 16,
          color:'red',
          message: "内容内容提示",
          position: [1000, 799],
          maxWidth: 200,
        },
        button: {
          message: "完成",
          position:[1000, 900]
        },
      },
      {
        el: rect2,
        shape:'round',
        text: {
          fontSize: 16,
          color:'red',
          message: "内容内容提示提示提示提示提示提示提示,内容内容提示提示提示提示提示提示提示,",
          position: [810, 200],
          maxWidth: 200,
        },
        button: {
          fontSize: 16,
          color:'red',
          message: "下一步",
          width: 100,
          height: 70,
        },
      },
      {
        el: rect2,
        text: {
          fontSize: 16,
          color:'red',
          message: "内容内容提示提示提示提示提示提示提示,内容内容提示提示提示提示提示提示提示,",
          position: [810, 200],
          maxWidth: 200,
        },
        button: {
          fontSize: 16,
          color:'red',
          message: "下一步",
          width: 100,
          height: 70,
        },
      },
    ]
    guideCanvas(stepsArr,()=>{
      console.log('指引结束后的回调')
    })
    }
</script>

API 说明

参数类型默认值是否必填说明
callback'function'false指引结束后的回调函数
eltrue节点的 DOM 对象
shape'rect'或'round''rect'false以透明矩形或者圆形展示DOM 对象
text.messageStringtrue节点的 DOM 对象指引的文本
text.positionArrarytrue文本展示的位置x,y,以canvas画布坐标系为参考
text.fontSizeNumber20false文本字体大小
text.colorString'white'false文本字体的颜色
text.lineHeightNumber20false文本文字的行高
text.maxWidthNumber200false文本排列的最大宽度,超出宽度会换行
button.messageString'下一步'false按钮文字
button.fontSizeNumber15false按钮文字大小
button.colorString'black'false按钮文字颜色
button.positionArrary文本正下方false按钮位置x,y,以canvas画布坐标系为参考
button.widthNumber80false按钮宽度
button.heightNumber40false按钮高度
1.0.5

1 year ago

1.0.2

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago