1.1.0 • Published 3 years ago

widget-sdk v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

widget-sdk

Installation

npm install widget-sdk

Usage

//in vue
<template>
   <widget-render src="widget地址" :name="name" @logout-click="handleLogoutClick" >
    <template slot="page-main">
      <div>main</div>
    </template>
   </widget-render>
</template>

<script>
import { WidgetRender, EventCenter } from "widget-sdk"
export default {
   components: {
      WidgetRender
   },
   data() {
     return {
       name: 'widget-sdk'
     }
   },
   methods: {
      handleLogoutClick() {
        console.log('触发退出登录按钮')
      },
   },
   mounted() {
     const bus = new EventCenter('namescope')
     bus.emit('event-name')
   }
}
</script>

EventCenter API

on(name,action)

add event

off(name,action?)

remove event

once(name,action)

add evnet for one time

emit(name:string|string[])

emit event by name or name array

has(name:string)

check event name exists

first(name:string,action)

remove events of name
then add action of the same name

Changelog

详细更新内容

1.1.0

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.1.14

3 years ago

0.1.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.9

3 years ago

0.1.4

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago