摘要: 数组方法 (Array) .findIndex(array, [predicate=.identity], [fromIndex=0]) [查找索引] 找到数组中predicate断言为true的第一个数组元素索引,未找到返回-1. 如果要从数组末尾开始查找则使用:.findLastIndex(ar 阅读全文
posted @ 2025-08-29 14:39 箫笛 阅读(12) 评论(0) 推荐(0)
摘要: 自定义事件.sync 修饰符的使用 在有些情况下,我们可能需要对一个 prop 进行“双向绑定” // 子组件: this.$emit('update:title', newTitle) // 父组件 <text-document v-bind:title="doc.title" v-on:upda 阅读全文
posted @ 2025-08-29 14:29 箫笛 阅读(19) 评论(0) 推荐(0)
摘要: 在Vue项目中使用SVG图标可以提高加载速度并方便自定义,以下是几种常见的实现方式: 方法一:直接导入SVG文件(推荐) 首先创建一个全局组件 SvgIcon.vue: <template> <svg :class="svgClass" aria-hidden="true" v-bind="$att 阅读全文
posted @ 2025-08-29 11:01 箫笛 阅读(207) 评论(0) 推荐(0)