随笔分类 -  前端

摘要:<script setup lang="ts"> import {ref} from "vue"; const selectName = ref('技术指标及标准') const nacigation = ref([ '技术指标及标准', '文献著作', '报告模版', '专家库/项目库',])</ 阅读全文
posted @ 2024-04-24 11:01 无泪的遗憾、愿我能 阅读(8) 评论(0) 推荐(0) 编辑
摘要:vue运行为v-on在监听键盘事件时,添加了特殊的键盘修饰符: <input v-on:keyup.13="submit"> vue还非常贴心地给出了常用按键的别名,这样就不必去记keyCode ~ ~ 上面代码,还可以在这样写: <input v-on:keyup.enter="submit"> 阅读全文
posted @ 2023-12-15 14:55 无泪的遗憾、愿我能 阅读(24) 评论(0) 推荐(0) 编辑
摘要:<nav> <div :class="{ 'menu-item': true, 'activity': index == selectMenuIndex }" v-for="(menuInfo,index) in menuList" :key="index" @click="handelMenuCl 阅读全文
posted @ 2023-11-28 17:30 无泪的遗憾、愿我能 阅读(349) 评论(0) 推荐(0) 编辑
摘要:refresh() { /* 浏览器标签页切换会触发"visibilitychange"事件*/ document.addEventListener('visibilitychange', e => { // 切换显示标签 if (document.visibilityState 'visible' 阅读全文
posted @ 2023-11-21 16:03 无泪的遗憾、愿我能 阅读(6) 评论(0) 推荐(0) 编辑
摘要:configureWebpack: { // provide the app's title in webpack's name field, so that // it can be accessed in index.html to inject the correct title. name: 阅读全文
posted @ 2023-11-21 11:27 无泪的遗憾、愿我能 阅读(50) 评论(0) 推荐(0) 编辑
摘要:directives: { enter: { bind(el, binding) { document.addEventListener('keyup', (event) => { if (event.keyCode 13) { binding.value() } }) } } }, v-enter 阅读全文
posted @ 2023-11-20 23:06 无泪的遗憾、愿我能 阅读(28) 评论(0) 推荐(0) 编辑
摘要:const arr = []this.todoLeftList.forEach((item) => { arr.push(item.srcSystemCode)})const index = arr.indexOf('zldc')if (index) { const first = this.tod 阅读全文
posted @ 2023-11-20 22:58 无泪的遗憾、愿我能 阅读(28) 评论(0) 推荐(0) 编辑
摘要:mounted(){ // 先调用initParam接口 再调用第二个接口 this.initParam().then((res)=>{ this.getDataList(); }) },// 1. 把方法挂载到全局 methods: { async initParam(){ const {code 阅读全文
posted @ 2023-11-18 13:38 无泪的遗憾、愿我能 阅读(89) 评论(0) 推荐(0) 编辑
摘要:background-image: url($img), linear-gradient(#f00, #f00);//也可以实现渐变 filter: grayscale(100%) hue-rotate(180deg) brightness(0.5) contrast(200%); img { mi 阅读全文
posted @ 2023-11-16 20:06 无泪的遗憾、愿我能 阅读(102) 评论(0) 推荐(0) 编辑
摘要:let data = [ {id: 2, time: '2019-04-26 10:53:19'}, {id: 4, time: '2019-04-26 10:51:19'}, {id: 1, time: '2019-04-26 11:04:32'}, {id: 3, time: '2019-04- 阅读全文
posted @ 2023-11-06 19:08 无泪的遗憾、愿我能 阅读(20) 评论(0) 推荐(0) 编辑
摘要:在做项目的时候遇到了一个问题, 就是把项目部署到不同的服务器上, 但不能每次修改IP的时候就打包一次, 这就增加了前端的工作量,经过百度, 发现有一些方法是可以的,亲测可用。 具体操作是, 1,在static文件夹下面建立一个config.js文件, 1 2 3 4 5 6 7 (function  阅读全文
posted @ 2023-08-27 15:32 无泪的遗憾、愿我能 阅读(80) 评论(0) 推荐(0) 编辑
摘要:响应式数据的判断 isRef: 检查一个值是否为一个 ref 对象 isReactive:检查一个对象是否是由 reactive 创建的响应式代理 isReadonly:检查一个对象是否是由 readonly 创建的只读代理 isProxy:检查一个对象是否是由reactive或者 readonly 阅读全文
posted @ 2023-02-23 15:03 无泪的遗憾、愿我能 阅读(21) 评论(0) 推荐(0) 编辑
摘要:作用:实现祖孙组件间通信 父组件有一个 provide 选项来提供数据,子组件有一个 inject 选项来开始使用这些数据 具体写法: 1.祖组件中: setup(){ let car = reactive({name:'奔驰',price:'40万'}) provide('car',car) } 阅读全文
posted @ 2023-02-23 14:51 无泪的遗憾、愿我能 阅读(260) 评论(0) 推荐(0) 编辑
摘要:作用:创建一个 ref 对象,其value值指向另一个对象中的某个属性。语法:const name = toRef(person,'name') 应用:要将响应式对象中的某个属性单独提供给外部使用时。 扩展: toRefs 与 toRef 功能一致,但可以批量创建多个 ref 对象,语法: toRe 阅读全文
posted @ 2023-02-23 14:20 无泪的遗憾、愿我能 阅读(27) 评论(0) 推荐(0) 编辑
摘要:watchEffect 刚开始调用一次, watchEffect 里面用谁监视谁,有点像computed 但是计算属性注重的是计算出来的值,但是watchEffect 没有返回值 而是重新走逻辑流程 watchEffect(()=>{ console.log('watchEffect :>> ', 阅读全文
posted @ 2023-02-13 23:40 无泪的遗憾、愿我能 阅读(33) 评论(0) 推荐(0) 编辑
摘要:vue2响应式原理: 对象类型:通过Object.defineProperty() 对属性读取、修改进行拦截(数据劫持) 数组类型:通过重写更新数组的一系列方法来实现拦截。(对数组的变更方法进行了包裹) vue2 响应式实现 let person = { name: '张三', age: 18 } 阅读全文
posted @ 2023-02-12 23:20 无泪的遗憾、愿我能 阅读(140) 评论(0) 推荐(0) 编辑
摘要:在 vue.config.js 配置项中 lintOnSave: false 阅读全文
posted @ 2023-02-12 21:14 无泪的遗憾、愿我能 阅读(27) 评论(0) 推荐(0) 编辑
摘要:突然发现个很有意思的事 一个列表设置默认的功能 开发的时候只有两个item,循环的key设置为了id,改变默认后重新请求数据但是后端重新排序导致id一样出现了dom比较的小bug,key设置为index就好了 阅读全文
posted @ 2023-02-08 13:25 无泪的遗憾、愿我能 阅读(16) 评论(0) 推荐(0) 编辑
摘要:修改props // 将 prop 数据转换为本地数据 computed: { initData: function () { return this.fName = this.firstName } } // 这样对本地数据进行修改,控制台也不会报错, js基本数据类型都是值传递,所以无论如何修改 阅读全文
posted @ 2023-02-08 13:11 无泪的遗憾、愿我能 阅读(88) 评论(0) 推荐(0) 编辑

浏览器标题切换
浏览器标题切换end
点击右上角即可分享
微信分享提示