UNPKG

cloud-ui.vusion

Version:
52 lines (51 loc) 1.69 kB
- name: m-publisher title: 发布订阅模式 options: - name: publish type: "{ [prop: string]: string | Function | object }" default: null description: "键为需要发布的主题,值为需要监听的表达式或函数。值也可以为一个对象`{ expOrFn: String \\| Function, deep: Boolean, immediate: Boolean }`,`deep`和`immediate`与官方`watch`中的意义相同。" methods: - name: $publish(topic, data) description: 发布话题 params: - name: topic type: string description: 话题名称 - name: data type: any description: 话题数据 - name: $unpublish(topic) description: 取消发布话题 params: - name: topic type: string description: 话题名称 - name: m-subscriber options: - name: subscribe type: "{ [prop: string]: string | Function | object }" default: null description: "键为需要订阅的主题,值为订阅时执行的方法。值也可以为一个对象`{ handler: String \\| Function, once: Boolean }`,`once`开启,则只订阅一次。" methods: - name: $subscribe(topic, func) description: 订阅话题 params: - name: topic type: string description: 话题名称 - name: func type: Function description: 订阅方法 - name: $unsubscribe(topic, func) description: 取消订阅话题 params: - name: topic type: string description: 话题名称 - name: func type: Function description: 订阅方法