Vue2随笔-251030

news/2025/10/31 2:37:19/文章来源:https://www.cnblogs.com/MiddleByPass/p/19178232

指令修饰符

  1. @click.stop 禁止子点击事件冒泡调用父标签事件。
  2. @click.prevent 禁止标签默认行为。
  3. @model.trim(number) 去除首尾空格,转为数字类型。
  4. v-model默认值 与select标签绑定,默认值必须在option中存在。

计算属性

存在返回值,执行依赖于关联属性的变化。不用箭头函数,防止this指向异常。

两种写法:

computed: {name: {return this.firstName + this.secondName}sign: {get: ()=>{return this.appid + this.info}set: (newVal)=>{var infos = newValue.split('|')this.appid = infos[0]this.info = infos[1]}}
}

watch侦听器

使用 watch 选项允许我们执行异步操作 (访问一个 API),限制我们执行该操作的频率,并在我们得到最终结果前,设置中间状态。这些都是计算属性无法做到的。
非Vue管理模块用箭头函数(setTimeout)this指向不会脱离Vue实例。

两种写法:

data: {id = ''},
watch:{id(newVal,oldVal){属性变化时执行逻辑},info:{deep: true,handler(newVal): {属性变化时执行逻辑}}
}

延时请求

clearTimeout(this.to)
this.to = setTimeout(async()=>{
await axios({url: xxx,heads: xxx,data: xxx})
},1000)

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

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

相关文章

qw-110-

import org.apache.poi.ss.usermodel.Workbook;import org.springframework.core.io.buffer.DataBuffer;import org.springframework.core.io.buffer.DataBufferUtils;import org.springframework.http.MediaType;impo…

qw-33

import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.netty.http.client.HttpClient; import reactor.nett…

qw-12

import org.springframework.core.io.ByteArrayResource;import org.springframework.core.io.buffer.DataBuffer;import org.springframework.core.io.buffer.DataBufferUtils;import org.springframework.http.Media…

reactive -03

import org.springframework.core.io.buffer.DataBuffer;import org.springframework.core.io.buffer.DataBufferUtils;import org.springframework.http.codec.multipart.FilePart;import org.springframework.web.re…

reactive - 02

import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.web.reactive.function.BodyInserters;import org.springfra…

reactive-01

package com.hyman.service; import org.springframework.core.io.ByteArrayResource;import org.springframework.core.io.buffer.DataBufferUtils;import org.springframework.http.HttpHeaders;import org.springfr…

revit api获取excursion 拉伸体的轮廓和平面sketchplane GeometryCreationUtilities

revit api获取excursion 拉伸体的轮廓和平面sketchplane GeometryCreationUtilitiespublic void GetSketchFromExtrusion() {Document doc = this.ActiveUIDocument.Document;Extrusion extrusion = doc.GetEleme…

revit api创建模型线

revit api创建模型线public void CreateModelCurve() {Document doc = this.ActiveUIDocument.Document; // 在族文档中找到名字为"Ref. Level"的标高FilteredElementCollector collector = new Filtered…

revit 创建sketchplane

revit 创建sketchplanesketchplane在创建某些图元时候可以用到 public void CreateSketchPlaneByPlane() {Document doc = this.ActiveUIDocument.Document; using(Transaction trans = new Transaction(doc, "…

revit api创建参考线

revit api创建参考线参考线可以用modelcurve转化而来 public void ChangeModelCurveToReferenceLine() { Document doc = this.ActiveUIDocument.Document; ModelCurve modelCurve = doc.GetElement(new…

【AI说HTML 04】掌握核心文档结构标签的方法

要真正掌握HTML的核心文档结构标签,关键在于理解它们如何像搭积木一样,共同构建起一个清晰、语义明确的网页骨架。下面这个流程图概括了一个网页的典型结构,帮你先建立整体印象: flowchart TDA[<!DOCTYPE html&…

revit api创建参考平面

revit api创建参考平面public void CreatReferencePlane() {Document doc = this.ActiveUIDocument.Document; if(!doc.IsFamilyDocument)return;using(Transaction transaction = new Transaction(doc, "Edit…

【AI说HTML 02】如何深刻建立对HTML的正确认知

要深刻建立对HTML的正确认知,关键在于理解它不仅仅是用来“画”出网页样子的工具,更是一套用于描述内容结构和含义的语言。下面这个表格梳理了理解HTML时需要建立的核心认知维度。认知维度 错误认知(新手常见) 正确…

【AI说HTML 03】手把手教你搭建极简HTML开发环境

为你打造一个极简且高效的HTML开发环境,其实只需要几个核心步骤。下面这张流程图概括了全过程,你可以先有一个整体的了解,再跟着后续的详细步骤操作。 flowchart TDA[下载并安装VS Code] --> B[安装必备插件<…

图元编辑 移动 旋转 镜像等

图元编辑 移动 旋转 镜像等编辑1 Document projectDoc = ActiveUIDocument.Document;using(Transaction moveColumnTran = new Transaction(projectDoc, "Move a new column to the new place")) {moveCol…

【AI说】如何深刻建立对HTML的正确认知

要深刻建立对HTML的正确认知,关键在于理解它不仅仅是用来“画”出网页样子的工具,更是一套用于描述内容结构和含义的语言。下面这个表格梳理了理解HTML时需要建立的核心认知维度。认知维度 错误认知(新手常见) 正确…

计算机组成原理核心知识点梳理

SQLAlchemy是Python中最流行的ORM(对象关系映射)框架之一,它提供了高效且灵活的数据库操作方式。本文将介绍如何使用SQLAlchemy ORM进行数据库操作。 目录 安装SQLAlchemy 核心概念 连接数据库 定义数据模型 创建数…

revit api 内置族类型 walltype

revit api 内置族类型 walltype复制墙类型 Wall wall = RevitDoc.GetElement(new ElementId(185521)) as Wall; WallType wallType = wall.WallType; ElementType duplicatedWallType = wallType.Duplicate(wallType.…

国产的编程语言

​1、非修改序列算法 这些算法不会改变它们所操作的容器中的元素。 1.1 find 和 find_if find(begin, end, value):查找第一个等于 value 的元素,返回迭代器(未找到返回 end)。 find_if(begin, end, predicate):查…