javascript
弓弧名家_玄真君
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
React 组件生命周期
在本章节中我们将讨论 React 组件的生命周期。组件的生命周期可分成三个状态:Mounting:已插入真实 DOMUpdating:正在被重新渲染Unmounting:已移出真实 DOM生命周期的方法有:componentWillMount 在渲染前调用,在客户端也在服务端。componentDidMount : 在第一次渲染后调用转载 2017-10-26 09:55:54 · 361 阅读 · 0 评论 -
使用propTypes进行类型检查
博客园首页新随笔联系管理订阅随笔- 58 文章- 0 评论- 1 React文档(十五)使用propTypes进行类型检查随着你的应用的开发,你会使用类型检查的方法来捕获很多bug。对于一些应用,你可以使用js扩展就像Flow或者TypeScript去对整个应用进行类型检查。但是即使你不是用这些扩展语言,React也有一些内置转载 2017-10-26 09:57:25 · 5905 阅读 · 0 评论 -
art-template学习之路
https://segmentfault.com/q/1010000009656768https://aui.github.io/art-template/docs/syntax.html原创 2017-08-07 22:15:16 · 337 阅读 · 0 评论 -
vue webpack配置eslint eslint-friendly-formatter
安装eslint cnpm install eslint eslint-loader eslint-config-standard eslint-plugin-standard eslint-plugin-promiseeslint-plugin-import --save-devcnpm install eslint-plugin-html babel-eslintesl原创 2017-07-27 15:54:55 · 11243 阅读 · 0 评论 -
eslint 的三大通用规则
eslint官方提供了3种预安装包:eslint-config-googleGoogle标准执行安装:npm install eslint eslint-config-google -geslint-config-airbnbAirbnb标准,它依赖eslint, eslint-plugin-import, eslint-plugin-react, and es原创 2017-07-27 11:47:47 · 18826 阅读 · 0 评论 -
react 父组件调子组件的方法
1、引入相关js<script src="js/react.js"></script><script src="js/react-dom.js"></script><script src="js/browser.min.js"></script><script s转载 2018-03-22 13:44:09 · 8295 阅读 · 2 评论 -
redux+react+webpack+热加载+兼容IE8(持续更新)
http://blog.youkuaiyun.com/jiestyle21/article/details/50836988转载 2017-07-23 00:04:46 · 721 阅读 · 0 评论 -
react with JSX for {if…else…}
在react中用jsx渲染dom的时候经常会遇到if条件判断,然而在jsx中竟是不允许if条件判断的。以下有几种判断方式,可以根据自己的应用场景,挑选适合的。方案一:class HelloMessage extends React.Component { render (){ let userMessage; if (this.props.loggedIn) {转载 2017-10-26 10:00:37 · 580 阅读 · 0 评论 -
react webpack配置
http://archive.is/15Qm0转载 2017-07-22 21:44:50 · 228 阅读 · 0 评论 -
npm install 时总是报phantomjs-prebuilt@2.1.14安装失败
转自:http://www.cnblogs.com/alice626/p/6206722.html在npm install时总是报如下错误,尝试单独安装:npm install phantomjs-prebuilt@2.1.14 还是报错 Please report this full log at https://github.com/Medium/phantom转载 2017-02-14 23:55:58 · 13669 阅读 · 0 评论 -
vue 配置babel
首先install babelcnpm install --save-dev babel-loader babel-core babel-preset-env babel-plugin-transform-runtime babel-plugin-istanbul babel-polyfill babel-preset-stage-2 babel-register原创 2017-07-22 21:43:24 · 10401 阅读 · 0 评论 -
vue---vue2.x中父组件如何触发子组件事件方法?
转自:http://blog.youkuaiyun.com/Wbiokr/article/details/781382941. 父组件中获取子组件方法$children<template> <div> <v-header></v-header> <v-content></v-content> ...转载 2018-03-22 13:33:25 · 6048 阅读 · 2 评论 -
vue子组件调父组件的方法
我发现了两种写法。方法一:子组件:<template> <button @click="submit">提交</button></template><script>export default { methods: { submit: function () { // 子组件中触发父组件方法ee并传值...转载 2018-03-22 13:39:10 · 833 阅读 · 2 评论 -
javascript中的window.btoa与window.atob的简单加解密
WindowOrWorkerGlobalScope.btoa()从String对象中创建一个 base-64 编码的 ASCII 字符串,其中字符串中的每个字符都被视为一个二进制数据字节。Note: 由于这个函数将每个字符视为二进制数据的字节,而不管实际组成字符的字节数是多少,所以如果任何字符的码位超出 0x00 ~ 0xFF 范围,则会引发InvalidCharacterEr...原创 2019-10-10 14:11:26 · 2428 阅读 · 0 评论 -
vue-cli3.0-beta vue脚手架3.0的使用
转自:https://www.jianshu.com/p/fbcad30031c2中文文档https://github.com/vuejs/vue-docs-zh-cn在安装之前请装好nodeJs1.使用npm install -g @vue/cli# oryarn global add @vue/cli查看版本(是否安装成功):vue -V(大写的V)1...转载 2019-04-28 17:35:34 · 1071 阅读 · 0 评论 -
vue 插件和axios封装
https://www.awesomes.cn/repo/mzabriskie/axioshttp://blog.youkuaiyun.com/qq20004604/article/details/56965703原创 2017-08-04 14:06:11 · 506 阅读 · 0 评论 -
webpack-hot-middleware热加载相关错误的解决办法
http://blog.youkuaiyun.com/yiifaa/article/details/71550496?utm_source=itdadao&utm_medium=referral错误1:找不到__webpack_hmrGET http://127.0.0.1/__webpack_hmr 404 (Not Found)11在webpack的entry配置添加引用路径’we转载 2017-07-22 15:53:19 · 2193 阅读 · 0 评论 -
前端 vue编译 依赖库 报错问题Class constructor FileManager cannot be invoked without ‘new‘
排查是less版本问题升级less 和less-loader 就ok原创 2019-10-15 14:33:43 · 404 阅读 · 0 评论 -
vue-cli 的功能注释url
http://blog.youkuaiyun.com/hongchh/article/details/55113751http://www.cnblogs.com/ye-hcj/p/7087205.html原创 2017-07-24 00:14:22 · 404 阅读 · 0 评论 -
vue+axios 实现post文件下载
axios.post(axios.post(downloadUrl, reqData, { responseType: 'blob'}).then(res => { let blob = res.data let reader = new FileReader() reader.readAsDataURL(blob) reader.onload = (e) => ...原创 2018-06-26 17:03:42 · 10105 阅读 · 5 评论 -
解决vue项目路由出现message: “Navigating to current location (XXX) is not allowed“的问题
原因:在路由中添加了相同的路由。解决:重写路由的push方法在src/router/index.js 里面import Router from 'vue-router'下面写入下面方法即可/** * 重写路由的push方法 */const routerPush = Router.prototype.pushRouter.prototype.push = function pu...原创 2019-10-25 16:55:46 · 15519 阅读 · 2 评论 -
vue watch store
https://segmentfault.com/q/1010000011682795转载 2018-08-03 13:42:20 · 4466 阅读 · 0 评论 -
记录Vue打包或保存频繁内存溢出情况CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
如图所示:频繁出现此种情况,项目太大,导致内存溢出,排除代码问题外,可参照以下方式解决全局安装increase-memory-limitnpm install -g increase-memory-limit进入工程目录,执行:increase-memory-limit转载自:https://blog.youkuaiyun.com/liub37/article/details/82866763...转载 2019-04-03 11:52:43 · 15390 阅读 · 0 评论 -
vue打包字体文件路径错误的问题
问题1转载自https://www.jianshu.com/p/458fe9cb3490根本原理请看:https://github.com/vuejs-templates/webpack/issues/166在我的项目中遇到的情形是:打包后,css里加载的font文件路径变成了:/static/css/static/fonts/element-icons.535877f.woff,...原创 2019-07-31 17:15:25 · 1232 阅读 · 1 评论 -
html-webpack-plugin详解
转自:http://www.cnblogs.com/wonyun/p/6030090.html引言最近在react项目中初次用到了html-webapck-plugin插件,用到该插件的两个主要作用:为html文件中引入的外部资源如script、link动态添加每次compile后的hash,防止引用缓存的外部文件问题可以生成创建html入口文件转载 2017-07-22 13:57:05 · 1196 阅读 · 0 评论 -
vue 多页面架子资料
https://github.com/bluefox1688/vue-cli-multi-pagehttps://github.com/yaoyao1987/vue-cli-multipagehttps://github.com/luchanan/vue2.0-multi-pagehttps://github.com/vincentmrlau/vue-multi-device-原创 2017-08-05 10:25:28 · 310 阅读 · 0 评论 -
vue 新页面打开页面
const {href} = this.$router.resolve({ path: 'add-new-order', query: { update_order: true, main_id: window.btoa(this.main_id) } })...原创 2019-10-10 14:02:08 · 197 阅读 · 0 评论 -
vue环境搭建(有热替换)
好文章自己先收藏一下,怕以后找不到。 文章转自:http://www.cnblogs.com/wj204/p/6031435.html前面vue2.0和webpack都已经有接触了些(vue.js入门, webpack入门之简单例子跑起来 ),现在开始学习如何构造自己的vue2.0+webpack环境。1.首先新建一个目录vue-wkdemo,这是我们的项目目录。执行转载 2017-07-22 15:46:59 · 1714 阅读 · 0 评论 -
vue ui库
https://www.iviewui.com/components/carousel原创 2017-08-03 11:25:16 · 337 阅读 · 0 评论 -
小程序成長之路_引入小程序自带icon 和 引用阿里图标
上篇我们已经成功填加tabBar,那么我们这篇就讲解一下引用图标icon,小程序里有自己的图标供大家使用,但是图标有限,有很多都满足不了我们的需求。这次呢给大家介绍一下阿里图标,里面有大量的图标供你选择,点击http://www.iconfont.cn/进入阿里图标库下面我就给大家介绍两种引用icon的方法 ,引用小程序自带icon和引用阿里图标一、引用小程序自带icon1...原创 2019-08-20 23:12:33 · 444 阅读 · 0 评论 -
小程序开发】VSCode-:识别wxml,wxss文件为html,css格式
问题描述:由于wxml 及 wxss文件不能直接被识别,因此在vscode中作为纯文本,可以在右下角纯文本出点击修改,然而!在几个页面编辑 需要来回切换,它就偶尔翻脸不认识了,又变回了纯文本,反复改了几次,决定解决掉这个问题:处理办法:在vscode扩展中(快捷键shift+command+X):1.识别wxml:搜索wxml,安装插件vscode wxml.2.识别wxss:搜索...转载 2018-08-03 14:08:28 · 3571 阅读 · 0 评论 -
小程序组件获取元素宽高失效 和canvas绘制问题
解决办法:在自定义组件内获取必须用SelectorQuery.in()Component({ lifetimes: { ready() { const query = wx.createSelectorQuery().in(this) const num = Math.ceil(this.data.picList.length / LINE_LENGT...原创 2019-08-19 00:05:27 · 2153 阅读 · 0 评论 -
小程序图片上传用upng转base64 图片旋转180度的问题 (ios)
最近业务需要:将图片转为base64格式。 so~~~;百度n多资料最后写成,还是有一点小bug就是生成的图片不太清晰; 文章最后还有代码的下载地址参考资料: 微信小程序文档-wx.canvasGetImageData UPNG.js下载地址 代码奉上: wxml<!-- wxml --><button bindtap='fetch'>上传</bu...转载 2018-08-08 12:49:24 · 3324 阅读 · 1 评论 -
小程序图片转Base64,方法总结。
转自:https://blog.youkuaiyun.com/qq_36875339/article/details/81086205前言:看了很多博客没一个能解决问题的,小程序社区也逛了个遍,依然找不到小程序图片在本地转base64的方法,凡事还得靠自己啊,接下来就把所有方法做个总结,作为一个野生程序员,好东西绝对要分享。如果不想了解踩坑历史的话,直接看第四种方法就可以了。如果不想了解踩坑...转载 2019-03-29 18:58:31 · 1011 阅读 · 0 评论 -
微信小程序自定义组件boundingClientRect获取到的rect值为null
解决办法:在自定义组件内获取必须用SelectorQuery.in()Component({ lifetimes: { ready() { const query = wx.createSelectorQuery().in(this) const num = Math.ceil(this.data.picList.length / LINE_LENGT...原创 2019-10-16 13:47:56 · 8396 阅读 · 1 评论 -
js正则表达式语法
1.1 普通字符 字母、数字、汉字、下划线、以及后边章节中没有特殊定义的标点符号,都是"普通字符"。表达式中的普通字符,在匹配一个字符串的时候,匹配与之相同的一个字符。 举例1:表达式 "c",在匹配字符串 "abcde" 时,匹配结果是:成功;匹配到的内容是:"c";匹配到的位置是:开始于2,结束于3。(注:下标从0开始还是从1开始,因当前编程语言的不同而可能不同)转载 2016-06-05 22:01:51 · 6750 阅读 · 0 评论 -
图片懒加载
/** * Created by yangbys168 on 2016-01-14 15:05:51 * url: http://www.qdfuns.com/notes/15548/9376db07e06b5ac998d614223d4ff4e6 */var lazyload = { init : function(opt){ var that = this...原创 2019-09-03 20:25:44 · 135 阅读 · 1 评论 -
前端爬坑日记之vue内嵌iframe并跨域通信
由于该项目是基于原本的安卓app,做的微信h5,所以原来的使用webview的页面现在需要在vue中实现,那就是使用iframe查看了很多很多文档,其中这一篇是很有价值的https://gist.github.com/pboji...下面将3天的爬坑最终以问答的方式总结如下:1、Vue组件中如何引入iframe?2、vue如何获取iframe对象以及iframe内的windo...原创 2019-12-11 09:52:15 · 869 阅读 · 0 评论 -
Service Worker 学习笔记
转自:https://segmentfault.com/a/1190000004653475Service Worker 学习笔记Service Worker挺有意思的,前段时间看了相关的资料,自己动手调了调demo,记录一下学习过程。文中不仅会介绍Service Worker的使用,对fetch、push、cache等Service Worker配套的API都会涉及,毕竟Service...转载 2019-04-25 18:03:27 · 883 阅读 · 0 评论 -
angluarjs1.*踩坑
1.起服务遇到报错Warning: not found: compass Use --force to continue解决先用choco install ruby 安装ruby再用gem install compass 安装compass然后就好了遇到 directory .tmp/styles error app/styles/main.sc...原创 2019-05-23 15:03:28 · 250 阅读 · 0 评论
分享