码迷,mamicode.com
首页 >  
搜索关键字:prototype    ( 5322个结果
Vue+Typescript中在Vue上挂载axios使用时报错
在vue项目开发过程中,为了方便在各个组件中调用axios,我们通常会在入口文件将axios挂载到vue原型身上,如下:main.ts import Vue from 'vue' import axios from './utils/http' Vue.prototype.$axios = axio ...
分类:移动开发   时间:2020-12-14 13:30:26    阅读次数:9
JS 原型与原型链以及new的执行过程
每一个函数都会自带3个属性(construtor,__proto__,prototype) 每一个对象都会自带2个属性(constructor,__proto__) 什么是constructor、什么是__proto__、什么是prototype? 它们之间的关系是怎样的? 它们的作用是什么? __ ...
分类:Web程序   时间:2020-12-10 10:52:29    阅读次数:9
js学习
_ _ proto _ _ 属性总结 ? (1)首先,我们需要牢记两点:①__proto__和constructor属性是对象所独有的;② prototype属性是函数所独有的。但是由于JS中函数也是一种对象,所以函数也拥有__proto__和constructor属性。 ? (2)__proto_ ...
分类:Web程序   时间:2020-12-08 13:00:33    阅读次数:14
js foreach 不能中断的现象及理解
现象: 下例为一个js的foreach操作,看打印的结果,return是无法中断foreach处理的。 var testArray = [1, 2, 3, 4, 5]; testArray.forEach(element => { if (element == 3) { return; } cons ...
分类:Web程序   时间:2020-12-07 12:03:22    阅读次数:10
原型模式(Prototype Pattern)
原型模式:使用克隆技术复制创建复杂的或者构造耗时的实例,被复制的对象就是所谓的“原型”。 应用场景 a、类初始化需要消耗非常多的资源,包括数据库、硬件资源等,使用拷贝可避免这些消耗 b、new产生的对象需要非常繁琐的数据准备或权限 c、Spring框架中的多例就是使用原型 如何实现 (1)实现Clo ...
分类:其他好文   时间:2020-12-03 12:31:08    阅读次数:17
Event when input value is changed by JavaScript?
监听 js 动态 修改 input value 事件 方案1 function customInputSetter(){ var descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value"); va ...
分类:编程语言   时间:2020-12-02 12:06:03    阅读次数:6
vue-cli4创建项目导入elementUI,浏览器报错Uncaught TypeError: Cannot read property ‘prototype‘ of undefined
解决:vue-cli4创建项目导入elementUI,浏览器报错Uncaught TypeError: Cannot read property ‘prototype‘ of undefined 如果直接使用命令安装vueclie:npm install -g @vue/cli 就会直接安装最新版本 ...
分类:其他好文   时间:2020-11-04 18:42:25    阅读次数:39
简单实现深拷贝工具函数
consttype=obj=>{vartoString=Object.prototype.toString;varmap={‘[objectArray]‘:‘array,‘[objectObject]‘:‘object‘}returnmap[toString.call(obj)]}cosntdeepClone=data=>{var
分类:其他好文   时间:2020-11-02 10:51:51    阅读次数:45
vue中echarts的使用
1.安装 npm install echarts --save main.js import echarts from 'echarts' Vue.prototype.$echarts = echarts 2. <div id="chart15" :style="{width: '100%', he ...
分类:其他好文   时间:2020-10-14 20:39:25    阅读次数:25
JS常见的API扩展形式(prototype、jquery、vue插件封装)以及怎样设计出易扩展的表单验证功能?
常见的API扩展形式 prototype 比如我现在有一个需求,给定一个字符串,给方法传递一个参数为数字类型来确定当前字符串重复次数,例如: 'abc'.repeatStringNumTimes(3) // abcabcabc 如果按照一般的思维就是我们把这个方法绑定到String的原型上,如下代码 ...
分类:Windows程序   时间:2020-10-13 17:33:50    阅读次数:26
5322条   上一页 1 ... 5 6 7 8 9 ... 533 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!