上一页 1 ··· 6 7 8 9 10 11 12 13 下一页
摘要: (1)交换变量的值 [x, y] = [y, x]; (2)提取JSON数据 var jsonData = { id: 42, status: "OK", data: [867, 5309] }; let { id, status, data: number } = jsonData; consol 阅读全文
posted @ 2021-09-28 11:26 果果1024 阅读(37) 评论(0) 推荐(0)
摘要: 1.数组的解构赋值 let [x = 1, y = x] = []; // x=1; y=1 let [x = 1, y = x] = [2]; // x=2; y=2 let [x = 1, y = x] = [1, 2]; // x=1; y=2 let [x = y, y = 1] = []; 阅读全文
posted @ 2021-09-28 11:12 果果1024 阅读(28) 评论(0) 推荐(0)
摘要: 有两个非常相似的组件,他们的基本功能是一样的,但他们之间又存在着足够的差异性,此时的你就像是来到了一个分岔路口:我是把它拆分成两个不同的组件呢?还是保留为一个组件,然后通过props传值来创造差异性从而进行区分呢? 阅读全文
posted @ 2021-09-28 10:13 果果1024 阅读(99) 评论(0) 推荐(0)
摘要: import Vue from 'vue'; import ElementUI from 'element-ui'; Vue.component('el-input', { extends: ElementUI.Input, created() { this.$on('change', (value 阅读全文
posted @ 2021-09-28 09:55 果果1024 阅读(540) 评论(0) 推荐(0)
摘要: 1.在JavaScript语言之中,一切皆对象,运行环境也是对象,所以函数都是在某个对象下运行,而this就是函数运行时所在的对象(环境)。 2.存函数的 地址 所属的对象,决定了this的运行环境。 实例: function foo() { console.log(this.a); } var o 阅读全文
posted @ 2021-09-27 17:37 果果1024 阅读(23) 评论(0) 推荐(0)
摘要: 作用:从外部读取局部变量 为什么外部变量不能读取局部变量 Javascript语言特有的"链式作用域"结构(chain scope),子对象会一级一级地向上寻找所有父对象的变量。所以,父对象的所有变量,对子对象都是可见的,反之则不成立。因此可以把闭包简单理解成"定义在一个函数内部的函数"。 优点:个 阅读全文
posted @ 2021-09-27 16:54 果果1024 阅读(98) 评论(0) 推荐(0)
摘要: 1.在app.js文件中,设置、读取和修改 globalData: { userInfo: null } this.globalData.userInfo this.globalData.userInfo = {} 2.在其他页面文件中,设置、读取和修改 index.js const app = g 阅读全文
posted @ 2021-09-27 11:27 果果1024 阅读(111) 评论(0) 推荐(0)
摘要: "pages": [ "pages/index/index" ] 1.新建页面少两个文件index.json、index.wxss,需要手动添加 2.遇到很神奇的一个问题index.json手动添加却不读取,项目重新在微信小程序编译工具中打开,好了,不知道为什么????????? 阅读全文
posted @ 2021-09-26 16:16 果果1024 阅读(1723) 评论(0) 推荐(0)
摘要: 1.所声明的变量,只在let命令所在的代码块内有效。 var a = []; for (let i = 0; i < 10; i++) { a[i] = function () { console.log(i); }; } a[6](); // 6变量i是let声明的,当前的i只在本轮循环有效,所以 阅读全文
posted @ 2021-09-25 12:46 果果1024 阅读(50) 评论(0) 推荐(0)
摘要: 1.初始化package.json npm init -y 2.下载npm资源包 npm i @vant/weapp -S --production 3.在微信开发者工具里面进行配置 点击详情 使用npm模块 点击工具 构建npm 4.使用 // app.json "usingComponents" 阅读全文
posted @ 2021-09-24 16:35 果果1024 阅读(81) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 下一页