女装网站建设规划书怎么写商城全网推广运营公司

web/2025/10/4 3:02:11/文章来源:
女装网站建设规划书怎么写,商城全网推广运营公司,h5怎么设计网页,广州seo公司目录 透传 Attributes Attributes 继承​ 对 class 和 style 的合并 v-on 监听器继承 深层组件继承 禁用 Attributes 继承 多根节点的 Attributes 继承 vue2 $attrs 和 $listeners $attrs 概念说明 $attrs 案例 $listeners 概念说明 $listeners案例 vue3 $attr…目录 透传 Attributes Attributes 继承​ 对 class 和 style 的合并 v-on 监听器继承 深层组件继承  禁用 Attributes 继承  多根节点的 Attributes 继承  vue2 $attrs 和 $listeners  $attrs 概念说明 $attrs 案例 $listeners 概念说明 $listeners案例 vue3 $attrs 和 $listeners  attrs在 template 中的用法 只有1个根元素的情况下 有2个根元素的情况下 $listeners  弃用 attrs在 js 中的用法 Options API Composition API 3.0的语法  Composition API 3.2的语法  总结 移除 $listeners  概览 2.x 语法 3.x 语法 $attrs 包含 class  style  概览 2.x 行为  3.x 行为 1$props当前组件接收到的 props 对象。Vue 实例代理了对其 props 对象属性的访问。 2$attrs包含了父作用域中不作为 prop 被识别 (且获取) 的特性绑定 (class 和 style 除外)。 3$listeners包含了父作用域中(不含 .native 修饰器的)v-on事件监听器。他可以通过 v-onlisteners传入内部组件 透传 Attributes 透传 Attributes 是指由父组件传入且没有被子组件声明为 props 或是组件自定义事件的 attributes 和事件处理函数。 Attributes 继承​ “透传 attribute”指的是传递给一个组件却没有被该组件声明为 props 或 emits 的 attribute 或者 v-on 事件监听器。最常见的例子就是 class、style 和 id。 当一个组件以单个元素为根作渲染时透传的 attribute 会自动被添加到根元素上。举例来说假如我们有一个 MyButton 组件它的模板长这样 !-- MyButton 的模板 -- buttonclick me/button 一个父组件使用了这个组件并且传入了 class MyButton classlarge / 最后渲染出的 DOM 结果是 button classlargeclick me/button 这里MyButton 并没有将 class 声明为一个它所接受的 prop所以 class 被视作透传 attribute自动透传到了 MyButton 的根元素上。 对 class 和 style 的合并 如果一个子组件的根元素已经有了 class 或 style attribute它会和从父组件上继承的值合并。如果我们将之前的 MyButton 组件的模板改成这样 !-- MyButton 的模板 -- button classbtnclick me/button 则最后渲染出的 DOM 结果会变成 button classbtn largeclick me/button v-on 监听器继承 同样的规则也适用于 v-on 事件监听器 MyButton clickonClick / click 监听器会被添加到 MyButton 的根元素即那个原生的 button 元素之上。当原生的 button 被点击会触发父组件的 onClick 方法。同样的如果原生 button 元素自身也通过 v-on 绑定了一个事件监听器则这个监听器和从父组件继承的监听器都会被触发。 深层组件继承  有些情况下一个组件会在根节点上渲染另一个组件。例如我们重构一下 MyButton让它在根节点上渲染 BaseButton !-- MyButton/ 的模板只是渲染另一个组件 -- BaseButton / 此时 MyButton 接收的透传 attribute 会直接继续传给 BaseButton。 请注意 透传的 attribute 不会包含 MyButton 上声明过的 props 或是针对 emits 声明事件的 v-on 侦听函数换句话说声明过的 props 和侦听函数被 MyButton“消费”了。 透传的 attribute 若符合声明也可以作为 props 传入 BaseButton。 禁用 Attributes 继承  如果你不想要一个组件自动地继承 attribute你可以在组件选项中设置 inheritAttrs: false。 最常见的需要禁用 attribute 继承的场景就是 attribute 需要应用在根节点以外的其他元素上。通过设置 inheritAttrs 选项为 false你可以完全控制透传进来的 attribute 被如何使用。 vue2  Vue 2 的虚拟 DOM 实现对 class 和 style attribute 有一些特殊处理。因此与其它所有 attribute 不一样它们没有被包含在 $attrs 中。 上述行为在使用 inheritAttrs: false 时会产生副作用 $attrs 中的 attribute 将不再被自动添加到根元素中而是由开发者决定在哪添加。但是 class 和 style 不属于 $attrs它们仍然会被应用到组件的根元素中 templatelabelinput typetext v-bind$attrs //label /template script export default {inheritAttrs: false } /scriptvue3 从 3.3 开始你也可以直接在 script setup 中使用 defineOptions script setup defineOptions({inheritAttrs: false }) // ...setup 逻辑 /script 这些透传进来的 attribute 可以在模板的表达式中直接用 $attrs 访问到。 spanFallthrough attribute: {{ $attrs }}/span 这个 $attrs 对象包含了除组件所声明的 props 和 emits 之外的所有其他 attribute例如 classstylev-on 监听器等等。 有几点需要注意 和 props 有所不同透传 attributes 在 JavaScript 中保留了它们原始的大小写所以像 foo-bar 这样的一个 attribute 需要通过 $attrs[foo-bar] 来访问。 像 click 这样的一个 v-on 事件监听器将在此对象下被暴露为一个函数 $attrs.onClick。 多根节点的 Attributes 继承  和单根节点组件有所不同有着多个根节点的组件没有自动 attribute 透传行为。如果 $attrs 没有被显式绑定将会抛出一个运行时警告。 CustomLayout idcustom-layout clickchangeValue / 如果 CustomLayout 有下面这样的多根节点模板由于 Vue 不知道要将 attribute 透传到哪里所以会抛出一个警告。 header.../header main.../main footer.../footer 如果 $attrs 被显式绑定则不会有警告 header.../header main v-bind$attrs.../main footer.../footer vue2 $attrs 和 $listeners  $attrs 概念说明 包含了父作用域中不作为 prop 被识别 (且获取) 的 attribute 绑定 (class 和 style 除外)$attrs 包含了传递给一个组件的 attribute 名和 attribute 值即一个JSON对象可以通过v-bind$attrs传入内部组件 $attrs 案例 父组件 templateSlotContainerrefslotContainernamehuangbiao:isOkfalse:option{ a: 1, b: true, c: ddd }/SlotContainer /templatescript import SlotContainer from ./SlotContainerexport default {data() {return {};},components: {SlotContainer,} }; /scriptstyle langscss scoped/style子组件 script export default {data() {return {};},props: {option: {type: Object,default: function() {return {};}}},mounted() {console.log(this.$attrs);},methods: {} }; /script结果 不注释掉子组件的props, $attrs的值 注释掉子组件的props, $attrs的值 inheritAttrs: false 和 $attrs 配合使用解决的问题  可以手动决定这些 attribute 会被赋予哪个元素inheritAttrs: false 选项不会影响 style 和 class 的绑定这个模式允许你在使用基础组件的时候更像是使用原始的 HTML 元素而不会担心哪个元素是真正的根元素 $listeners 概念说明 包含了父作用域中的 (不含 .native 修饰器的) v-on 事件监听器。可以配合 v-on$listeners 将所有的事件监听器指向这个组件的某个特定的子元素它是一个对象里面包含了作用在这个组件上的所有监听器。 $listeners案例 templatediv classSlotContainerrefslotContainerv-on:m1m1v-on:m2m2m3m3m4m4click.nativetestJiami/SlotContainer/div /templatescript import SlotContainer from ./SlotContainer; import CryptoJS from crypto-js; export default {data() {return {};},components: {SlotContainer,},methods: {testJiami() {this.m1();this.m2();this.m3();this.m4();},m1() {console.log(加密结果一 MD5: CryptoJS.MD5(你好));// 加盐 对应的APIconsole.log(加密结果一 MD5: CryptoJS.HmacMD5(你好, salt));console.log(CryptoJS.SHA256(123456).toString());// 加盐 对应的APIconsole.log(CryptoJS.HmacSHA256(123456, salt).toString());},m2() {var pwd passwor;console.log(加密结果二 Hmac-MD5: CryptoJS.HmacMD5(你好, pwd));},m3() {var salt CryptoJS.enc.Utf8.parse(salt); //盐var iter 1000; //迭代次数var mi CryptoJS.PBKDF2(你好, salt, {keySize: parseInt(4),iterations: parseInt(iter),});console.log(加密结果三 mi);},m4() {var pswd 我的密码;var mi CryptoJS.AES.encrypt(你好, pswd);console.log(加密结果四 mi);//解密var result CryptoJS.AES.decrypt(mi, pswd).toString(CryptoJS.enc.Utf8);console.log(解密结果 result);},}, }; /scriptstyle langscss scoped/style 子组件(SlotContainer.vue) script export default {data() {return {};},mounted() {console.log(this.$listeners);},methods: {} }; /scriptstyle langscss scoped/style 结果 click.nativetestJiami的方法没有在 $listeners中 vue3 $attrs 和 $listeners  简单来说 attrs 主要接收没在 props 里定义但父组件又传过来的属性。 !-- 父组件 ParentCom.vue -- templateChildCommsg雷猴data123/ /templatescript setup import ChildCom from ./ChildCom.vue /script!-- 子组件 ChildCom.vue -- templatediv{{ msg }} - {{ $attrs }}/div /templatescript setup defineProps({msg: {type: String} }) /script 可以看到在子组件中msg 使用了 props 接收所以 {{ msg }} 可以直接输出 props 里接收的内容。 而没在 props 里接收的内容全部都放到了 $attrs 里并且存在一个对象里面。 接下来将展开讲解不同情况下 attrs 的使用方法。 attrs在 template 中的用法 在前面简单的例子里其实已经大概知道 attrs 在 template 的用法。但 Vue3 中 template 不再要求只有一个根元素了。所以 attrs 在 template 中分2种情况使用。 只有1个根元素的情况下 只有1个根元素的情况下子组件中没被 props 接收的属性都会绑定在根元素上。 !-- 父组件 ParentCom.vue -- templateChildCommsg雷猴data123name鲨鱼辣椒stylecolor: red;/ /templatescript setup import ChildCom from ./ChildCom.vue /script!-- 子组件 ChildCom.vue -- templatediv{{ msg }}/div /templatescript setup defineProps({msg: {type: String} }) /script 可以看到没被 props 接收的属性都被绑定到根元素上了。 连 style 里传入的样式也被执行文字变成红色了。 有2个根元素的情况下 当子组件有2个根元素时没被 props 接收的属性不会绑定到子组件的元素上。 !-- 父组件 ParentCom.vue -- templateChildCommsg雷猴data123name鲨鱼辣椒stylecolor: red;/ /templatescript setup import ChildCom from ./ChildCom.vue /script!-- 子组件 ChildCom.vue -- templatediv{{ msg }}/divdiv{{ msg }}/div /templatescript setup defineProps({msg: {type: String} }) /script 此时连父组件传入是 style 样式都不生效了。 如果我们此时希望第二个元素绑定所有没被 props 接收的属性可以使用 v-bind$attrs 的方法实现 !-- 父组件 ParentCom.vue -- templateChildCommsg雷猴data123name鲨鱼辣椒stylecolor: red;/ /templatescript setup import ChildCom from ./ChildCom.vue /script!-- 子组件 ChildCom.vue -- templatediv{{ msg }}/divdiv v-bind$attrs{{ msg }}/div /templatescript setup defineProps({msg: {type: String} }) /script $listeners  弃用 $listeners 对象在 Vue 3 中已被移除。事件监听器现在是 $attrs 的一部分 {text: 这是一个 attribute,onClose: () console.log(close 事件被触发) }attrs在 js 中的用法 除了在 template 中可以访问到 $attrs 在 JS 中也可以访问到。 vue 3 其实是兼容大部分 Vue 2 语法的也就是 Options API 。而 attrs 在 Options APi 和 Composition Api 中的使用方法会稍微有一丢丢区别。而 Composition API 又分为 Vue 3.2 前的语法和 3.2 后的语法。 接下来将分开讨论这3种情况。 Options API !-- 父组件 ParentCom.vue -- templateChildCommsg雷猴data123name鲨鱼辣椒stylecolor: red;/ /templatescript setup import ChildCom from ./ChildCom.vue /script!-- 子组件 ChildCom.vue 暂不关注 template 部分 -- script export default {props: {msg: {type: String}},mounted() {console.log(this.$attrs)} } /script 此时控制台会输出没被 props 接收的属性。  Composition API 3.0的语法  !-- 父组件 ParentCom.vue -- templateChildCommsg雷猴data123name鲨鱼辣椒stylecolor: red;/ /templatescript setup import ChildCom from ./ChildCom.vue /script!-- 子组件 ChildCom.vue 暂不关注 template 部分 -- script export default {props: {msg: {type: String}},setup(props, context) {console.log(props: , props)console.log(attrs: , context.attrs)} } /script Vue 3.2 前的写法需要在 setup 方法里接收2个参数而 attrs 就在 context 参数里。 Composition API 3.2的语法  Vue 3.2 后的语法可以在 script 标签上添加 setup 属性。所以在代码里就不需要再调用 setup 方法了。 在这种情况下props 成了默认的全局方法而 attrs 则需要另外引入。 !-- 父组件 ParentCom.vue -- templateChildCommsg雷猴data123name鲨鱼辣椒stylecolor: red;/ /templatescript setup import ChildCom from ./ChildCom.vue /script!-- 子组件 ChildCom.vue 暂不关注 template 部分 -- script setup import { useAttrs } from vueconst props defineProps({msg: {type: String} })const attrs useAttrs()console.log(props: , props) console.log(attrs: , attrs) /script 需要引入 vue 中的 useAttrs 在调用 useAttrs 后会返回当前未被 props 接收的属性。 重点是以下两句。 import { useAttrs } from vue const attrs useAttrs() 总结 移除 $listeners  概览 $listeners 对象在 Vue 3 中已被移除。事件监听器现在是 $attrs 的一部分 {text: 这是一个 attribute,onClose: () console.log(close 事件被触发) }2.x 语法 在 Vue 2 中你可以通过 this.$attrs 访问传递给组件的 attribute以及通过 this.$listeners 访问传递给组件的事件监听器。结合 inheritAttrs: false开发者可以将这些 attribute 和监听器应用到根元素之外的其它元素 templatelabelinput typetext v-bind$attrs v-on$listeners //label /template scriptexport default {inheritAttrs: false} /script3.x 语法 在 Vue 3 的虚拟 DOM 中事件监听器现在只是以 on 为前缀的 attribute这样它就成为了 $attrs 对象的一部分因此 $listeners 被移除了。 templatelabelinput typetext v-bind$attrs //label /template script export default {inheritAttrs: false } /script如果这个组件接收一个 id attribute 和一个 v-on:close 监听器那么 $attrs 对象现在将如下所示: {id: my-input,onClose: () console.log(close 事件被触发) }$attrs 包含 class  style  概览 $attrs 现在包含了所有传递给组件的 attribute包括 class 和 style。 2.x 行为  Vue 2 的虚拟 DOM 实现对 class 和 style attribute 有一些特殊处理。因此与其它所有 attribute 不一样它们没有被包含在 $attrs 中。 上述行为在使用 inheritAttrs: false 时会产生副作用 $attrs 中的 attribute 将不再被自动添加到根元素中而是由开发者决定在哪添加。但是 class 和 style 不属于 $attrs它们仍然会被应用到组件的根元素中 templatelabelinput typetext v-bind$attrs //label /template script export default {inheritAttrs: false } /script像这样使用时 my-component idmy-id classmy-class/my-component……将生成以下 HTML label classmy-classinput typetext idmy-id / /label3.x 行为 $attrs 包含了所有的 attribute这使得把它们全部应用到另一个元素上变得更加容易了。现在上面的示例将生成以下 HTML labelinput typetext idmy-id classmy-class / /label在使用了 inheritAttrs: false 的组件中请确保样式仍然符合预期。如果你之前依赖了 class 和 style 的特殊行为那么一些视觉效果可能会遭到破坏因为这些 attribute 现在可能被应用到了另一个元素中。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/86559.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

智能网站推广优化福州做网站建设

总览 MineCraft是一个很好的例子,说明何时堆外内存确实可以提供帮助。 关键要求是: 保留的数据大部分是一个简单的数据结构(在我的世界的情况下,它的很多字节[]) 堆外内存的使用可以隐藏在抽象中。 考试 我使用以下测…

建设网站的工作流程价值30万的网站建设

prototype 属性的作用 JavaScript 规定,每个函数都有一个prototype属性,指向一个对象。 function f() {} typeof f.prototype // "object" ​ 上面代码中,函数f默认具有prototype属性,指向一个对象。 对于普通函数来…

百盛联合建设集团网站成功的软文推广

目录 一、ELK 简介 1.1 组件说明 1.2 为什么要使用ELK 1.3 完整日志系统的基本特征 1.4 ELK工作原理 二、Elasticsearch的介绍 2.1 Elasticsearch的核心: 三、Logstash 3.1 Logstash简介 四、Kibana 五、部署ELK日志分析系统 5.1 服务器配置 5.2 ELK Elasticse…

网站 成功因素南京十大广告公司

一、根据二叉树创建字符串 思路:在正常前序递归遍历的基础上,单独加上一个考虑到右子树为空的情况,如下:其结果为 1(2(4(5)(6)))&…

杭州电商网站建设公司青海省建设厅网站

不知道大家在写代码的时候,摸不摸鱼,是不是时不时得打开一下微博,看看今天发生了什么大事,又有谁塌房,而你没有及时赶上。 为此,我决定开发一个vscode插件,来查看微博热搜 插件名称&#xff1…

坪山网站建设渠道不备案如何架设网站

一 redis单线程与多线程 1.1 redis单线程&多线程 1.redis的单线程 redis单线程主要是指Redis的网络IO和键值对读写是由一个线程来完成的,Redis在处理客户端的请求时包括获取 (socket 读)、解析、执行、内容返回 (socket 写) 等都由一个顺序串行的主线程处理…

佛山 网站建设安装wordpress主题失败

文章目录 前言一、鼠标点击的角度测量二、二维码条形码识别 前言 一、鼠标点击的角度测量 首先导入一个带有角度的照片 然后下面的代码注册了一个鼠标按下的回调函数, 还有一个点的数列,鼠标事件为按下的时候就记录点,并画出点,…

济南网站优化收费怎么做网站demo

爆破音 true [t],发真实的 t。 单词的开始处重读音节的开始处,且前面没有跟着清辅音 [s] held 住不发声 叫法很多,声门塞音、吞音、喉塞(s)音、stop [t],held [t],不爆破的 [t]。 发音的口…

wordpress问答模块怎么做网络推广优化

目录 一、动态语言 二、创建C#dll 1.VS中创建一个C#语言的库工程 2.添加UnityEngine.dll的依赖 3.编写代码,生成dll 三、Unity使用dll 一、动态语言 计算机编程语言可以根据它们如何将源代码转换为可以执行的代码来分类为静态语言和动态语言。 静态语言&…

google网站增加关键词百度线上推广

# 首先在保证php已经正确安装的情况下:# 安装jdk(本人安装jdk7) 和 scala 因为kafka基于scala开发# 之后解压安装包 进入 运行命令 ./gradlew jar # 会下载一些包 # 首先运行 zookeeper ./bin/zookeeper-server-start.sh ./config/zookeeper.properties# 之后运行k…

南昌网站建设冲浪者网站移动端

程序是基于Matlab2016a,工具箱版本为Robotic Toolbox 10.2 参考博客: MATLAB机器人工具箱使用 Matlab Robotic Toolbox V9.10工具箱(三):轨迹规划 六轴机器人建模方法、正逆解、轨迹规划实例与Matalb Robotic Toolbox 的实现 效果&#xff1a…

北京国贸网站建设公司小红书如何引流推广

⭐️ 本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 [彭旭锐] 和 BaguTree Pro 知识星球提问。 学习数据结构与算法的关键在于掌握问题背后的算法思维框架,你的思考越抽象,它能覆盖的问题域就越广,理解难度…

怎样创建购物网站东莞设计网站推荐

grpc 流式传输下载各种文件(文本或二进制文件)是每个企业应用程序的生死攸关的事情。 PDF文档,附件,媒体,可执行文件,CSV,超大文件等。几乎每个应用程序迟早都必须提供某种形式的下载。 下载是通…

怎么样网站建设温州cms建站系统

一、进程与线程 认识 程序由指令和数据组成,简单来说,进程可以视为程序的一个实例 大部分程序可以同时运行多个实例进程,例如记事本、画图、浏览器等少部分程序只能同时运行一个实例进程,例如QQ音乐、网易云音乐等 一个进程可以…

做网站学什么软件雨花区最新情况

javafx 调用接口作为UI框架开发人员,提供自定义控件外观和行为的方法是我工作的一部分。 在许多情况下,这是通过允许框架用户在控件上注册工厂来完成的。 过去,我会为此创建一个工厂接口,并在框架内提供一个或多个默认实现。 这些…

一个网站的构建网站seo优化有哪些方面

htmlcss前端作业 王者荣耀官网6个页面无js 下载地址 https://download.csdn.net/download/qq_42431718/89571150 目录1 目录2 项目视频 王者荣耀6个页面(无js) 页面1 页面2 页面3 页面4 页面5 页面6

深圳网站制作开发排名国家世界新闻

前言文本已收录至我的GitHub仓库,欢迎Star:https://github.com/bin392328206种一棵树最好的时间是十年前,其次是现在six-finger-web一个Web后端框架的轮子从处理Http请求【基于Netty的请求级Web服务器】 到mvc【接口封装转发)】,再…

电子商务网站建设的规章制度wordpress 主题选项

前言 字符串学了三天,七道题。初窥kmp,已经感受到算法的博大精深了。 内容 对字符串的操作可以归结为以下几类: 字符串的比较、连接操作(不同编程语言实现方式有所不同); 涉及子串的操作,比…

大型网站建设兴田德润优惠奢侈品回收

2023. 连接后等于目标字符串的字符串对 给你一个 数字 字符串数组 nums 和一个 数字 字符串 target ,请你返回 nums[i] nums[j] (两个字符串连接)结果等于 target 的下标 (i, j) (需满足 i ! j)的数目。 示例 1&…

营销企业网站制作php网站欣赏

HALCON 快速入门手册 1 什么是 HALCON HALCON 是德国 MVtec 公司开发的一套完善的标准的机器视觉算法包,拥有应用广泛 的机器视觉集成开发环境。它节约了产品成本,缩短了软件开发周期——HALCON 灵活的 架构便于机器视觉,医学图像和图像分析应…