03 2020 档案
摘要:### elementUI中涉及到组件嵌套的时候如何进行传值-slot插槽作用域 ```vue <template> <zujian> <template slot-scope="props"> <p>{{props.row.属性}}</p> </template> </zujian> </temp
阅读全文
摘要:### 项目搭建 vue create my_cms Babel Router Vuex CSS Use history mode for router? n Sass/SCSS (with dart-sass) In package.json Save this as a preset for f
阅读全文
摘要:### 拿到登录的token ①api/index.js中添加user接口: user: { login: "/v3/login" }, ②api/request.js中导出 userLoginApi 接口(注意是post方法): export const userLoginApi=(data)=>
阅读全文
摘要:### ts配置路由 ①安装:npm i vue-router -S ②src下新建pages/Home.vue(还有Goods.vue、Detail.vue等页面): <template> <div class="home"> <h2>首页</h2> </div> </template> <scr
阅读全文
摘要:### vue-cli创建项目 Babel TypeScript Use class-style component syntax? Yes Use Babel alongside TypeScript (required for modern mode, auto-detected polyfil
阅读全文
摘要:在函数体内操作某个变量时,如何明确这个变量操作的是全局变量还是局部变量? 向上查找,如果在函数体内找到了与该变量相同的变量名,并且这个变量时局部变量,说明该行操作的变量也是局部变量。 向上查找时,如果在函数体内没有找到和该变量相同名称的变量,继续向函数体外查找,如果找到说明该行操作的变量是全局变量。
阅读全文
摘要:vue响应式数据的原理-vue最大的特点就是数据驱动视图,vue的数据改变,页面一定发生改变吗?这也不一定。当操作引用类型的数据,动态添加属性时,页面不会发生改变。vue响应式的原理:底层是Object.defineProperty(),目前vue2.6和将来的vue3.0都是通过给data中的数据
阅读全文
摘要:表单修饰符: 1、lazy:懒加载 <input type="text" v-model="projectName" /> {{ projectName }} 此时输入框执行的事件是input事件,实时同步(双向绑定) <input type="text" v-model.lazy="project
阅读全文
摘要:1、vue的优点? 轻量级框架:只关注视图层,是一个构建数据的视图集合,大小只有几十kb 简单易学:国人开发,中文文档,不存在语言障碍,易于理解和学习 双向数据绑定:保留了angular的特点,在数据操作方面更为简单 组件化:保留了react的优点,实现了HTML的封装和重用,在构建单页面应用方面有
阅读全文
摘要:export导出一个变量值,用 import {} 接收 api/request.js utils/utils.js export default导出一个对象,对象中有属性和方法,用 import 变量名 接收,再用对象.属性、对象.方法 api/index.js utils/localStorag
阅读全文
摘要:### 渲染时因异步易报错的点 深层次的找到某个值: <div>{{childrenList[0].class2Name.name}}</div> 此时容易报错: vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: "TypeError:
阅读全文
摘要:better-scroll向下拉动回弹不置顶 pullDownRefresh: { threshold: 50, // 当下拉到超过顶部 50px 时,触发 pullingDown 事件 stop: 0 // 刷新数据的过程中,回弹停留在距离顶部还有 0px 的位置 } better-scroll的
阅读全文
摘要:height: calc(100vh - 100px); 屏幕高度减去100px flex-shrink:0; 防止控件压缩变形 outline:none; 取消input选中时的边框 width:max-content; 最大内容区宽度
阅读全文
摘要:### mock数据(模拟数据) json-server: 安装:npm install json-server -g(cmd终端中安装) 启动服务:json-server goods.json mock.js: 安装:npm i mockjs src下新建mock/test.js: const m
阅读全文
摘要:### City页面数据渲染-难点:cityList数据结构分析 ①api/index.js中添加city接口: cityList:{ city:"/v3/city" } ②api下新建request.js: import http from "@utils/request.js"; import
阅读全文
摘要:### 数据优化-localStorage ①store/homepage/index.js中拿到数据的时候,设置localStorage的homePage: actions:{ async getHomepage({commit}){ let data=await http({ method:"g
阅读全文
摘要:### 技术栈 vuex axios vue-lazyload vue-router UI框架 vant vue-touch better-scroll UI组件封装 JS组件封装 vue-awesome-swiper 安装插件:npm i axios vant vue-touch@next bet
阅读全文