- 博客(11)
- 收藏
- 关注
原创 手写深拷贝!!!
手写深拷贝!!!function deepClone(obj) { let res = null if ( typeof obj !== 'object' || obj === null) return obj if(obj instanceof Array) { res = [] } else { res = {} } for (const key in obj) { // 利用递归 深
2021-04-09 17:30:38
105
原创 初入 Webpack
webpack的基本使用1.创建项目目录并初始化创建项目,并打开项目所在目录的终端,输入命令:npm init -y2.安装webpack1).打开项目目录终端,输入命令:*npm install webpack webpack-cli -D*2).然后在项目根目录中,创建一个 webpack.config.js 的配置文件用来配置webpack在 webpack.config.js 文件中编写代码进行webpack配置,如下: module.exports = {
2020-08-28 21:54:59
111
原创 Vue过滤器 格式化时间
过滤器时间格式化:<div>{{time | formtime}}</div>filters: { formtime(val) { var date = new Date(Number(val)); //时间戳为10位需*1000,时间戳为13位的话不需乘1000 var Y = date.getFullYear() + "-"; var M = (date.getMonth() + 1 < 10 ? "0" + (date
2020-08-22 22:38:32
147
原创 命名路由的匹配规则
为了方便表示路由的路径,可以给路由规则起一个名字//router-link 的 to 前要加: 为属性绑定<router-link :to="{name:'user',params:{id:123}}">user</router-link><router-link :to="{name:'register',params:{name:'wanghao'}}">register</router-link>const User = {
2020-08-22 22:37:20
539
原创 动态路由匹配的基本用法
1.通过$route.params.xx来获取路由参数<router-link to="/user/1">user1</router-link><router-link to="/user/2">user2</router-link><router-link to="/user/3">user3</router-link> const User = { template: ` &
2020-08-22 22:33:16
291
原创 VueRouter 嵌套路由
1.在父路由中插入子路由链接,路由填充位 const Register = { template: ` <div> <div> <p>register组件<p> </div> <div class="innerbox"> <div class="ialist"> &
2020-08-22 22:18:52
102
原创 Vue Router基本用法
VUE routervue router 是vue.js的官方路由管理器vue router 包含以下功能:1.注册html5历史模式或hash模式2.支持嵌套路由3.支持路由参数4.支持编程式路由5.支持命名路由Vue Router基本用法1.引入相关库文件 <script src="./js/vue.min.js"></script> <script src="./js/vue-router_3.0.2.js"></script
2020-08-21 21:47:17
115
原创 前端路由 hash
1.hash以#/开始http://localhost:2021/#/life <a href="#/index" :class='onName=="index"? "active":""'>主页</a> <a href="#/school" :class='onName=="school"? " active ":""'>校园</a> <a href="
2020-08-20 22:53:38
100
原创 Axios 的基本使用(233)
// // GET 传统URL传参 axios.get('http://localhost:2021/axios?id=123') .then(ret => { console.log(ret.data); // data属性是固定的,属于axios的API 用来获取后台的响应数据 }); // // GET restful传参 axios.get('http...
2020-08-16 23:07:54
157
原创 VUE fetch的基本用法
tenx() 方法属于fetchAPI的一部分 它返回一个Promise实例对象 用于获取后台返回的数据 可调用后面的then方法// fetch的基本用法 fetch('http://localhost:2021/fetch').then((data) => { return data.text(); // 这里的then里面的data不能直接输出 需要return data.text() // data.text() 是一个 Promis
2020-08-14 21:34:46
1551
原创 Vue 组件间的数据交换
父组件向子组件传值1.组件内部通过props接收传递过来的参数 Vue.component('menu-item', { props: ['title'], data: function() { return { msg: '子组件的数据' } }, template: `<div>{{title}}</div>` })2.父
2020-07-30 21:30:48
500
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人