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

微信公众号直接链接网站怎么做b2b平台运营模式

微信公众号直接链接网站怎么做,b2b平台运营模式,海城网站建设,企业网站需要在公安局备案吗回顾 DOM原生事件event对象 当事件发生时,浏览器会创建一个event对象,并将其作为参数传递给事件处理函数。这个对象包含了事件的详细信息,比如: type:事件的类型(如 click)target&#xff1a…

回顾

DOM原生事件event对象

当事件发生时,浏览器会创建一个event对象,并将其作为参数传递给事件处理函数。这个对象包含了事件的详细信息,比如:

  • type:事件的类型(如 'click')
  • target:触发事件的元素
  • currentTarget:绑定事件监听器的元素(对于捕获和冒泡阶段,这可能不是触发事件的元素)
  • stopPropagation():阻止事件进一步传播(冒泡或捕获)
  • preventDefault():阻止事件的默认行为(比如,阻止链接的跳转)
  • timeStamp:事件发生的时间戳

watch 

Today 

组件注册

全局

import { createApp } from 'vue'const app = createApp({})app.component(// 注册的名字'MyComponent',// 组件的实现{/* ... */}
)

全局注册虽然很方便,但有以下几个问题:

  1. 全局注册,但并没有被使用的组件无法在生产打包时被自动移除 (也叫“tree-shaking”)。如果你全局注册了一个组件,即使它并没有被实际使用,它仍然会出现在打包后的 JS 文件中

  2. 全局注册在大型项目中使项目的依赖关系变得不那么明确。在父组件中使用子组件时,不太容易定位子组件的实现。和使用过多的全局变量一样,这可能会影响应用长期的可维护性。

局部

<script setup>
import ComponentA from './ComponentA.vue'
</script><template><ComponentA />
</template>
-----------------------------------------------
import ComponentA from './ComponentA.js'export default {components: {ComponentA},setup() {// ...}
}

props

  • defineProps() 宏来声明
  • props: ['foo']选项式声明

修改props

校验

$emit

 

Vue 3带来了许多新特性和改进,包括对Composition API的官方支持、更好的TypeScript集成、性能改进等。以下是一些Vue 3中常见的语法写法:

1. Composition API

Composition API 是 Vue 3 的核心特性之一,它提供了一种更加灵活和强大的方式来组织和重用逻辑。

<template> 
<div>{{ count }}</div> 
<button @click="increment">Increment</button> 
</template> <script> 
import { ref } from 'vue'; export default { 
setup() { 
const count = ref(0); function increment() { 
count.value++; 
} return { count, increment }; 
} 
}; 
</script>

2. 选项式API(仍受支持)

虽然Composition API是Vue 3的亮点,但Vue 3仍然完全支持Vue 2中的选项式API。

<template> 
<div>{{ message }}</div> 
<button @click="reverseMessage">Reverse</button> 
</template> <script> 
export default { 
data() { 
return { 
message: 'Hello Vue!' 
}; 
}, 
methods: { 
reverseMessage() { 
this.message = this.message.split('').reverse().join(''); 
} 
} 
}; 
</script>

4. Teleport

Teleport 是一种能够将模板内容“传送”到DOM中Vue应用之外的其他位置的技术。

<template> 
<teleport to="#modal-container"> 
<div class="modal"> 
... 
</div> 
</teleport> 
</template>

5. 自定义指令

Vue 3中的自定义指令与Vue 2类似,但在使用Composition API时,注册方式略有不同。

<template> 
<div v-focus></div> 
</template> <script> 
export default { 
directives: { 
focus: { 
mounted(el) { 
el.focus(); 
} 
} 
} 
}; 
</script> // 在Composition API中 
<script> 
import { onMounted, ref } from 'vue'; export default { 
setup() { 
const el = ref(null); onMounted(() => { 
el.value?.focus(); 
}); return { el }; 
}, 
directives: { 
focus: { 
mounted(el) { 
// 注意:这里不直接操作DOM,而是传递一个引用 
el.value = el; 
} 
} 
} 
}; 
</script>

注意:在Composition API中使用自定义指令时,可能需要一些变通方法来获取DOM元素,因为setup函数中没有this上下文。

6. Props 和 Emits

Props 和 Emits 的使用与Vue 2相似,但在Composition API中,你可能需要使用definePropsdefineEmits

<script setup> 
import { defineProps, defineEmits } from 'vue'; const props = defineProps({ 
title: String 
}); const emit = defineEmits(['update:title']); function updateTitle(newTitle) { 
emit('update:title', newTitle); 
} 
</script>

这些是Vue 3中一些常见的语法和特性。Vue 3提供了更灵活、更强大的开发方式,同时也保持了与Vue 2的兼容性。

 

http://www.hengruixuexiao.com/news/46163.html

相关文章:

  • 一个空间放两个网站优化seo报价
  • 高端大气网站案例温州网站建设优化
  • 网站做短信接口具体方法网站建设及网络推广
  • 个人博客网站教程北京seo网站开发
  • 做网站需要用到哪些开发软件网络营销的主要传播渠道是
  • 武汉网站建设ahuaseo百度登陆页面
  • 广州天河 网站建设百度云网盘免费资源
  • 高端网站建设页面百度网盘客服人工电话95188
  • 网站算阵地建设代运营哪家公司最靠谱
  • 有哪个网站做正品港货外贸推广网站
  • 做网站架构的软件公司做个网站多少钱
  • 怎么样提高网站排名千锋教育的官网
  • 网站seo优化方案做百度推广一个月多少钱
  • 哪个网站能找到做夜场的女孩2021最近比较火的营销事件
  • 做b2b网站如何盈利模式开发客户的70个渠道
  • html网页制作房地产页面优化网站seo策略
  • 制作网站的公司seo外贸公司推广
  • wordpress主题预览柏乡seo快排优化
  • 做个网站怎么做台州seo优化公司
  • 网站建设i rsky佛山seo关键词排名
  • 快速做网站哪家好网络优化工作内容
  • 长沙seo公司seo测试
  • 网页设计基础成果介绍谷歌seo代运营
  • 建程网官网seo代运营
  • 做网站外包哪家好网页设计页面
  • 营销型网站建设套餐百度霸屏培训
  • 有关做聚合物电池公司的网站seo优化效果怎么样
  • 廊坊模板网站建设无锡今日头条新闻
  • 平台网站制作网站seo入门基础教程书籍
  • wordpress微信绑定域名福建网络seo关键词优化教程