1.2.6 • Published 2 years ago

uview-easy-popup v1.2.6

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

uview-easy-popup

Installtion

npm i uview-easy-popup

Usage

<easy-popup ref="popup">
  <template v-slot:children="{ component }">
    <!--
      调用show的时候, 传入的component参数将在这里获取到
      用于判断当前popup需要打开渲染的组件是哪个
      这么做是考虑到不用每需要弹窗打开一个组件就写一个popup标签
    -->
    <TestComponent v-if="component === 'TestComponent'" />
    <TestComponent1 v-if="component === 'TestComponent1'" />
  </template>
</easy-popup>
import Vue from 'vue'
import EasyPopup from 'uview-easy-popup'
Vue.component('easy-popup', EasyPopup)

const instance = this.$refs.popup.show({
  component: 'TestComponent',
  data: 'hello world',
  emits: ['test'],
  onTest: () => {}
})

// 第二种事件交互方式也是可用的, 不需要手动处理off
instance.on('test', () => {})

Props

在组件内可以调用$emit('update-property', { property, value })修改下面任意参数

参数名说明类型必填默认值
component渲染组件的 name 值stringtrue
paddingpopup 默认 paddingbooleanfalse
modepopup 弹出方向stringbottom
heightpopup 高度string70vh
backgroundpopup 背景色string#ffffff
expandable开启收缩功能booleanfalse
zIndexpopup 层级number10075
onInit组件初始化函数名, 打开弹窗后会被调用(如果有)stringpopupLoad
data传递给 onInit 方法的数据any-
emits组绑定的事件名(用法参考示例)string[]-
onXxxx组绑定的事件回调函数, 例: { emits: ['click'], onClick: () => {} }function-
onClosepopup 关闭回调, 同时会调用 @closefunction-
onOpenpopup 打开回调, 同时会调用 @openfunction-
nextTickpopup 的 nextTick 回调, 入参是 componentfunction-

show 方法返回值

参数名说明类型
close关闭 popupfunction
on绑定组件事件函数function
1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

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