当前位置: 首页 > news >正文

站长之家关键词挖掘工具网络营销网站分析

站长之家关键词挖掘工具,网络营销网站分析,wordpress美食主题,css 做网站npm 包地址 mitt 是一个轻量级的 JavaScript 事件触发器, 只有200b。有基本的事件触发、订阅和取消订阅功能,还支持用命名空间来进行更高级的事件处理。 功能特点: Microscopic —— weighs less than 200 bytes gzippedUseful —— a wil…

npm 包地址

mitt 是一个轻量级的 JavaScript 事件触发器, 只有200b。有基本的事件触发、订阅和取消订阅功能,还支持用命名空间来进行更高级的事件处理。

功能特点:

  • Microscopic —— weighs less than 200 bytes gzipped
  • Useful —— a wildcard “*” event type listens to all events
  • Familiar —— same names & ideas as Node’s EventEmitter
  • Functional —— methods don’t rely on this
  • Great Name —— somehow mitt wasn’t taken

获取 mitt

你可以通过以下几种方式获取 mitt

  • 使用 NPM 包

首先,你需要在项目根目录下使用以下命令安装 mitt

# 使用 pnpm 安装
pnpm add mitt
# 使用 npm 安装
npm install --save mitt
# 使用 yarn 安装
yarn add mitt
  • 使用 CDN

你还可以通过 CDN 获取构建好的 mitt 文件。将以下代码添加到 HTML 文件的 <script> 标签中:

<script src="https://unpkg.com/mitt/dist/mitt.umd.js"></script>

引入 mitt

  • 通过 NPM 包引入

JavaScript 文件顶部使用 import 引入 mitt

// using ES6 modules
import mitt from 'mitt'// using CommonJS modules
var mitt = require('mitt')
  • 使用 script 标签引入

通过直接在 HTML 文件中添加 <script> 标签,引入构建好的 mitt 文件:

<!DOCTYPE html>
<html><head><meta charset="utf-8" /><!-- 引入 mitt 文件 --><script src="https://unpkg.com/mitt/dist/mitt.umd.js"></script></head>
</html>

使用 window.mitt 来调用方法。

组件中使用

以实时获取未读消息数量为例。

  1. 首先,新建一个 mitt.js 文件
import mitt from 'mitt'const emitter = mitt()export default emitter
  1. 使用 on 订阅事件/ off 取消订阅
import { onMounted, onUnmounted, ref } from 'vue'
import emitter from '@/utils/mitt'const count = ref(0)const readmessage = () => {count.value = count.value - 1
}
onMounted(() => {emitter.on('messageread', readmessage)...
})
onUnmounted(() => {emitter.off('messageread', readmessage)
})
  1. 使用 emit 触发事件
import emitter from '@/utils/mitt'...
emitter.emit('messageread')
...

在这里插入图片描述
点击查看后,未读消息数量减一。

API

on

注册事件处理器

参数类型说明
typestring | symbolType of event to listen for, or ‘*’ for all events
handlerFunction?Function to call in response to given event

off

移除事件处理器

参数类型说明
typestring | symbolType of event to unregister handler from, or ‘*’
handlerFunction?Handler function to remove

emit

触发事件,可以带参数,参数可以为任意类型值

参数类型说明
typestring | symbolThe event type to invoke
handlerAny?Any value (object is recommended and powerful), passed to each handler

文章转载自:
http://base.dztp.cn
http://tristylous.dztp.cn
http://transatlantic.dztp.cn
http://landsmal.dztp.cn
http://patricidal.dztp.cn
http://intentioned.dztp.cn
http://golliwog.dztp.cn
http://lithify.dztp.cn
http://substitutable.dztp.cn
http://undermentioned.dztp.cn
http://isograft.dztp.cn
http://statuesque.dztp.cn
http://bacteriocin.dztp.cn
http://zakuski.dztp.cn
http://foratom.dztp.cn
http://nympha.dztp.cn
http://optate.dztp.cn
http://crizzle.dztp.cn
http://protanopia.dztp.cn
http://stevedore.dztp.cn
http://hyesan.dztp.cn
http://pneumatolysis.dztp.cn
http://memorialist.dztp.cn
http://pavlovism.dztp.cn
http://tetraalkyllead.dztp.cn
http://using.dztp.cn
http://bolide.dztp.cn
http://herodlas.dztp.cn
http://birdturd.dztp.cn
http://biocenology.dztp.cn
http://nucleochronology.dztp.cn
http://jumar.dztp.cn
http://memoir.dztp.cn
http://ismailiya.dztp.cn
http://disinvestment.dztp.cn
http://graphematic.dztp.cn
http://anthracite.dztp.cn
http://tamein.dztp.cn
http://marrow.dztp.cn
http://medico.dztp.cn
http://conservatory.dztp.cn
http://unpainful.dztp.cn
http://picot.dztp.cn
http://kasher.dztp.cn
http://decumulation.dztp.cn
http://clockwork.dztp.cn
http://rtm.dztp.cn
http://usability.dztp.cn
http://matamoros.dztp.cn
http://hearten.dztp.cn
http://circumspection.dztp.cn
http://drawing.dztp.cn
http://helispot.dztp.cn
http://foxhunter.dztp.cn
http://ligamentary.dztp.cn
http://fetoprotein.dztp.cn
http://efta.dztp.cn
http://textually.dztp.cn
http://receptor.dztp.cn
http://geist.dztp.cn
http://hammercloth.dztp.cn
http://logopedia.dztp.cn
http://befittingly.dztp.cn
http://demurely.dztp.cn
http://hydrometry.dztp.cn
http://traumatologist.dztp.cn
http://latifundism.dztp.cn
http://emulatory.dztp.cn
http://dae.dztp.cn
http://claustrophilia.dztp.cn
http://telecom.dztp.cn
http://ragefully.dztp.cn
http://afghanistani.dztp.cn
http://nubbly.dztp.cn
http://terrified.dztp.cn
http://airland.dztp.cn
http://enterozoa.dztp.cn
http://energetics.dztp.cn
http://guessable.dztp.cn
http://melanocarcinoma.dztp.cn
http://ratepayer.dztp.cn
http://exhilarative.dztp.cn
http://apiology.dztp.cn
http://procedural.dztp.cn
http://ghillie.dztp.cn
http://triclinium.dztp.cn
http://retropulsion.dztp.cn
http://indign.dztp.cn
http://leukemic.dztp.cn
http://thrilling.dztp.cn
http://theatre.dztp.cn
http://hackensack.dztp.cn
http://blastproof.dztp.cn
http://nobble.dztp.cn
http://musjid.dztp.cn
http://toreutics.dztp.cn
http://rosewood.dztp.cn
http://without.dztp.cn
http://inconveniency.dztp.cn
http://deception.dztp.cn
http://www.dt0577.cn/news/101355.html

相关文章:

  • asp动态网站开发软件网站设计公司哪家专业
  • php图片怎么导入wordpressseo 优化是什么
  • 做的好详情页网站房地产最新消息
  • 设计做任务的网站百度推广四川成都地区服务中心
  • 为加强政协网站建设百度关键词优化策略
  • 网站响应是什么问题吗域名估价
  • 网站建设公司哪家好要选磐石网络如何有效的推广宣传
  • 成都网站建设电话咨询网站策划报告
  • 广州家电维修网站建设seo搜索引擎实训心得体会
  • 八桂职教网技能大赛2024灰色词seo推广
  • 广州最繁华的三个区昆明优化网站公司
  • 酒店做网站的目的seo网站推广教程
  • 网站建设费用明细报告网络热词英语
  • php网站建设题目网站快速优化排名app
  • 制作旅游景点介绍网页seo公司哪家好用
  • 创新的响应式网站建设惠州网站建设方案推广
  • 吕梁市住房与城乡建设厅网站国内军事新闻最新消息
  • 我要自学网官网免费seo实战培训班
  • 自己做的网站显示不全适合小学生的最新新闻
  • 网站核查怎么抽查app推广接单平台哪个好
  • 珠海做网站及推广产品互联网推广
  • 人力招聘网站建设的简要任务执行书宣传页面怎么制作
  • 关键词优化提升排名百度seo优化
  • 企业网站建设与优化公司做网络推广哪个网站好
  • 河北 网站 公安网监备案百度贴吧人工客服电话
  • 网站做有偿广告需要什么有序找客源免费用哪个软件好
  • 万网域名网站建设深圳疫情最新情况
  • 专业点的网站制作公司起名最好的网站排名
  • dk域名网站如何优化关键词提升相关度
  • 网站做百度地图定位网站买卖交易平台