上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 41 下一页
摘要: # 步骤 -安装 cnpm install -S axios -在组件中导入 import ajax from 'axios' -使用 created() { ajax.get('http://127.0.0.1:5000/').then(res => { console.log(res.data) 阅读全文
posted @ 2022-02-15 18:44 甜甜de微笑 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 一、组件的使用 1 每个组件都有三部分 <template>写html内容,原来组件的template</template> <script> js,data,methods,created,</script> <style>样式</style> 注意:写的html要在div中,不然可能会报错 2 阅读全文
posted @ 2022-02-15 17:31 甜甜de微笑 阅读(876) 评论(0) 推荐(0) 编辑
摘要: vue项目创建 1 vue环境 1.1 安装node: 直接下一步下一步 官网下载: https://nodejs.org/zh-cn/ 1.2 安装cnpm npm install 模块名 #npm比较慢,用某宝的cnpm来替换npm npm install -g cnpm --registry= 阅读全文
posted @ 2022-02-15 15:48 甜甜de微笑 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 1 vue官方 https://cn.vuejs.org/​cn.vuejs.org/ 2 Vue CLI # 创建vue项目,需要使用vue-cli ,vue脚手架:程序项目的骨架,只需要在固定位置写代码即可 # vue-cli需要基于源nodejs,安装 # python node python 阅读全文
posted @ 2022-02-15 14:45 甜甜de微笑 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 插槽 # 在定义组件是,预留一个地方使用标签 <slot></slot> 占位# 以后在父组件中的子组件的标签内部写 内容,html内容 就会被替换到<slot></slot>中 1 slot插槽 (内容分发) a. 单个slot b. 具名slot *混合父组件的内容与子组件自己的模板-->内容分 阅读全文
posted @ 2022-02-15 10:26 甜甜de微笑 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 1 动态组件 1 <component> 元素,动态地绑定多个组件到它的 is 属性2 <keep-alive> 保留状态,避免重新渲染 2 基本使用 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>ref放 阅读全文
posted @ 2022-02-14 21:49 甜甜de微笑 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 1 ref属性 ref放在普通标签上,拿到的就是普通标签本身(原生节点),原生节点的属性通过.获取ref放在子组件上,拿到的就是子组件对象-通过这种方式实现子传父(this.$refs.mychild.text)-通过这种方式实现父传子(调用子组件方法传参数) 2 ref放在普通标签上 <!DOCT 阅读全文
posted @ 2022-02-14 21:09 甜甜de微笑 阅读(398) 评论(0) 推荐(0) 编辑
摘要: vue之组件通信 1 组件通信 1 组件通信 1 父子组件传值 (props down, events up) 2 父传子之属性验证props:{name:Number}Number,String,Boolean,Array,Object,Function,null(不限制类型) 3 事件机制a.使 阅读全文
posted @ 2022-02-14 16:49 甜甜de微笑 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 一、组件化开发之定义局部组件 1.组件是什么?有什么用 扩展 HTML 元素,封装可重用的代码,目的是复用-例如:有一个轮播,可以在很多页面中使用,一个轮播有js,css,html-组件把js,css,html放到一起,有逻辑,有样式,有html 2.局部组件的定义和使用 定义局部组件:compon 阅读全文
posted @ 2022-02-14 16:15 甜甜de微笑 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 1 计算属性computed 复杂逻辑,模板难以维护 (1) 基础例子 (2) 计算缓存 VS methods-计算属性是基于它们的依赖进行缓存的。-计算属性只有在它的相关依赖发生改变时才会重新求值 (3) 计算属性 VS watch - v-model3 2 通过计算属性实现名字首字母大写 <!D 阅读全文
posted @ 2022-02-14 15:04 甜甜de微笑 阅读(42) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 41 下一页