1.1.0 • Published 2 years ago

popper-next v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

popper-next

是一款轻量的 Tooltip 插件

vue、react安装使用 推荐yarn

yarn add popper-next
或者
cnpm install popper-next -S

在html页面中如何使用

<script src="https://unpkg.com/popper-next"></script>
<script>
const btn = document.querySelector('.btn');
const tip = document.querySelector('.tip');
const Popper = createPopper(btn, tip);
</script>

<div class="btn">按钮</div>
<div class="tip">提示信息</div>

在VUE3 + ts中如何使用

<script setup lang="ts">
import { ref } from 'vue'
import createPopper, { PopperConfig } from 'popper-next'

const btn = ref<HTMLElement>();
const tip = ref<HTMLElement>();
const Popper: PopperConfig = createPopper(btn.value as HTMLElement, tip.value as HTMLElement);
</script>

<div ref="btn">按钮</div>
<div ref="tip">提示信息</div>

属性配置

全局配置属性

例如:所有tooltip位置默认初始化右边

import createPopper from 'popper-next'

createPopper.defaults.placement = 'right';

单个配置属性

例如:以下这个tooltip默认没有动画效果

import createPopper from 'popper-next'

const Popper = createPopper(referene, popper, {
  placement: 'top'
});
Popper.defaults.animate = false;

所有属性

属性说明类型可选值默认值必填
placement出现的位置stringtop/bottom/left/rightbottom
trigger触发行为stringhover/click/contextmenuhover
offset出现位置的偏移量number10
animate添加动画booleantrue / falsetrue
speed动画速度,单位毫秒number400
zIndex设置元素的堆叠顺序number2000

所有事件

事件说明类型返回值
show显示tooltipfunctionvoid
hide隐藏tooltipfunctionvoid

umd版本

https://unpkg.com/popper-next

1.0.1-alpha.26

2 years ago

1.0.1-alpha.25

2 years ago

1.0.1-alpha.24

2 years ago

1.0.1-alpha.23

2 years ago

1.0.1-alpha.29

2 years ago

1.0.1-alpha.27

2 years ago

1.0.1-alpha.22

2 years ago

1.0.1-alpha.21

2 years ago

1.0.1-alpha.20

2 years ago

1.0.1-alpha.37

2 years ago

1.0.1-alpha.36

2 years ago

1.0.1-alpha.35

2 years ago

1.0.1-alpha.34

2 years ago

1.0.1-alpha.39

2 years ago

1.0.1-alpha.38

2 years ago

1.0.1-alpha.33

2 years ago

1.0.1-alpha.32

2 years ago

1.0.1-alpha.31

2 years ago

1.0.1-alpha.30

2 years ago

1.0.1-alpha.48

2 years ago

1.1.0

2 years ago

1.0.1-alpha.47

2 years ago

1.0.1-alpha.46

2 years ago

1.0.1-alpha.45

2 years ago

1.0.1-alpha.49

2 years ago

1.0.1-alpha.40

2 years ago

1.0.1-alpha.44

2 years ago

1.0.1-alpha.43

2 years ago

1.0.1-alpha.42

2 years ago

1.0.1-alpha.41

2 years ago

1.0.1-alpha.15

2 years ago

1.0.1-alpha.58

2 years ago

1.0.1-alpha.57

2 years ago

1.0.1-alpha.56

2 years ago

1.0.1-alpha.19

2 years ago

1.0.1-alpha.18

2 years ago

1.0.1-alpha.17

2 years ago

1.0.1-alpha.16

2 years ago

1.0.1-alpha.51

2 years ago

1.0.1-alpha.50

2 years ago

1.0.1-alpha.55

2 years ago

1.0.1-alpha.54

2 years ago

1.0.1-alpha.53

2 years ago

1.0.1-alpha.52

2 years ago

1.0.1-alpha.14

2 years ago

1.0.1-alpha.13

2 years ago

1.0.1-alpha.12

2 years ago

1.0.1-alpha.11

2 years ago

1.0.1-alpha.10

2 years ago

1.0.1-alpha.8

2 years ago

1.0.1-alpha.7

2 years ago

1.0.1-alpha.6

2 years ago

1.0.1-alpha.5

2 years ago

1.0.1-alpha.4

2 years ago

1.0.1-alpha.3

2 years ago

1.0.1-alpha.2

2 years ago

1.0.1-alpha.1

2 years ago

1.0.1-alpha.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.0-alpha.0

2 years ago