摘要: 在项目开发时,我们常常用到ref和refs两个属性。 一、一般来说,如果我们把ref属性定义到html元素之上,我们就可以对html元素进行DOM操作了,省去了传统的Document.getlelementById操作了, 例如: <input type="text" ref="input" /> 阅读全文
posted @ 2020-10-31 23:19 li阿根 阅读(3393) 评论(0) 推荐(1) 编辑
摘要: 在实际项目中,路由跳转前做一些验证,比如登录验证,是网站中的普遍需求。举个例子,我们通常使用 router.beforeEach 注册一个全局前置守卫用来判断登录的状态: let routesArr = [{ path: '/home', name:"home", //redirect:"/abou 阅读全文
posted @ 2020-10-22 14:43 li阿根 阅读(2909) 评论(0) 推荐(0) 编辑
摘要: 在vue.js中,通常使用watch来响应数据的变化。一般常见的watch的三大用法入下: 1. 一般用法 <input type="text" v-model="id"/> new Vue({ el: '#app', data: { id: 1 }, watch: { id(newVal,oldV 阅读全文
posted @ 2020-10-22 13:31 li阿根 阅读(816) 评论(0) 推荐(0) 编辑
摘要: indexOf 和 includes js中我们经常要用到判断某一字符串中是否包含某个元素或者值,常见的两个方法如下 var ss="hello monkey!" console.log(ss.indexOf('monkey'))// 如果包含,则返回查询字符串的个数,不包含则返回-1; conso 阅读全文
posted @ 2020-10-18 15:47 li阿根 阅读(27017) 评论(0) 推荐(1) 编辑
摘要: 一般,在js数组中我们经常使用slice、split()、shift()、等常见方法,我们如何在数组中绑定自己的方法返回数组中的最大值呢? function array_max( ) { var i, max = this[0]; for (i = 1; i < this.length; i++) 阅读全文
posted @ 2020-10-18 13:57 li阿根 阅读(397) 评论(0) 推荐(0) 编辑
摘要: 在实际项目中,我们会遇到这样的需求,把用户的留言以邮件的方式发送到指定邮箱中。该如何实现? 本文以PHP为例,代码来自一位不知名的大佬,本文重在引用,废话不多说,直接上代码: mai.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transiti 阅读全文
posted @ 2020-08-13 13:33 li阿根 阅读(1044) 评论(1) 推荐(0) 编辑
摘要: 学习TED(最优质的演讲):https://www.ted.com/谷粉学术: https://gfsoso.99lb.net/scholar.html大学资源网:http://www.dxzy163.com/简答题:http://www.jiandati.com/网易公开课:https://ope 阅读全文
posted @ 2020-05-19 16:22 li阿根 阅读(903) 评论(0) 推荐(0) 编辑
摘要: 搞学习 猿学:http://yuanxue365.com/ 简书:https://www.jianshu.com/ doyoudo:http://www.doyoudo.com/ 好知网:http://www.howzhi.com/ 学小易(大学生搜题)https://www.51xuexiaoyi 阅读全文
posted @ 2020-05-19 16:13 li阿根 阅读(659) 评论(0) 推荐(0) 编辑
摘要: 第一步:修改main.js import axios from 'axios' Vue.prototype.$axios = axios axios.defaults.baseURL = '/api' 第二步:修改 config 下面的index.js文件 dev: { env: require(' 阅读全文
posted @ 2020-05-14 16:00 li阿根 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 1.使用背景:和客户沟通后,要在input=date控件中默认显示当天日期; 2.html部分:<input type="date" id="dateTime"> 3.js部分: var d = new Date(); var day =d.getDate(); if(d.getMonth()<10 阅读全文
posted @ 2020-04-20 13:36 li阿根 阅读(2387) 评论(0) 推荐(1) 编辑