1.1.0 • Published 4 years ago

popper-next v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 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

4 years ago

1.0.1-alpha.25

4 years ago

1.0.1-alpha.24

4 years ago

1.0.1-alpha.23

4 years ago

1.0.1-alpha.29

4 years ago

1.0.1-alpha.27

4 years ago

1.0.1-alpha.22

4 years ago

1.0.1-alpha.21

4 years ago

1.0.1-alpha.20

4 years ago

1.0.1-alpha.37

4 years ago

1.0.1-alpha.36

4 years ago

1.0.1-alpha.35

4 years ago

1.0.1-alpha.34

4 years ago

1.0.1-alpha.39

4 years ago

1.0.1-alpha.38

4 years ago

1.0.1-alpha.33

4 years ago

1.0.1-alpha.32

4 years ago

1.0.1-alpha.31

4 years ago

1.0.1-alpha.30

4 years ago

1.0.1-alpha.48

4 years ago

1.1.0

4 years ago

1.0.1-alpha.47

4 years ago

1.0.1-alpha.46

4 years ago

1.0.1-alpha.45

4 years ago

1.0.1-alpha.49

4 years ago

1.0.1-alpha.40

4 years ago

1.0.1-alpha.44

4 years ago

1.0.1-alpha.43

4 years ago

1.0.1-alpha.42

4 years ago

1.0.1-alpha.41

4 years ago

1.0.1-alpha.15

4 years ago

1.0.1-alpha.58

4 years ago

1.0.1-alpha.57

4 years ago

1.0.1-alpha.56

4 years ago

1.0.1-alpha.19

4 years ago

1.0.1-alpha.18

4 years ago

1.0.1-alpha.17

4 years ago

1.0.1-alpha.16

4 years ago

1.0.1-alpha.51

4 years ago

1.0.1-alpha.50

4 years ago

1.0.1-alpha.55

4 years ago

1.0.1-alpha.54

4 years ago

1.0.1-alpha.53

4 years ago

1.0.1-alpha.52

4 years ago

1.0.1-alpha.14

4 years ago

1.0.1-alpha.13

4 years ago

1.0.1-alpha.12

4 years ago

1.0.1-alpha.11

4 years ago

1.0.1-alpha.10

4 years ago

1.0.1-alpha.8

4 years ago

1.0.1-alpha.7

4 years ago

1.0.1-alpha.6

4 years ago

1.0.1-alpha.5

4 years ago

1.0.1-alpha.4

4 years ago

1.0.1-alpha.3

4 years ago

1.0.1-alpha.2

4 years ago

1.0.1-alpha.1

4 years ago

1.0.1-alpha.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-alpha.0

4 years ago