随笔分类 - vue
vue
摘要:1,beforCreate 在实例初始化之后被调用 2,created 在实例创建完成后被立调用 3,beforMount 在挂载开始之前被调用 4,mounted 挂载到实例之后被调用 5,beforeUpdate 数据更新被调用 6,updated 虚拟DOM重新渲染和打补丁 7,beforeD
阅读全文
摘要:1,onLaunch 当uni-app初始化完成时触发(全局只触发一次) 2,onShow 监听用户进入小程序 3,onHide 监听用户离开小程序 4,onError 当uni-app 报错时候触发 5,onUniNViewMessage 对nvue页面发送的数据进行监听 6,onUnhandle
阅读全文
摘要:javascript对象用{} 可以存放任意类型数据 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta na
阅读全文
摘要:1,var var是函数级别的作用域 2,let let是块级的作用域(花括号) let 不存在变量提升
阅读全文
摘要:父组件import {provide, ref} from 'vue' provide('data-key', 'this is room data')子组件 import { inject } from "vue"; const roomData = inject('data-key')
阅读全文
摘要:<template> <div> <h1>{{ message }}</h1> <button @click="btnclick">点击</button> </div> </template> <script> export default{ data(){ return{ message:'hel
阅读全文
摘要:app.vue <template> <h1>插槽知识</h1> <SmallSlot> <template #header> <div> <ul> <li>1</li> <li>2</li> <li>3</li> </ul> </div> </template> <template #main="
阅读全文
摘要:vue 插槽slot 父组件为子组件传递html结构 app.vue <template> <h1>插槽知识</h1> <SmallSlot> <div> <ul> <li>1</li> <li>2</li> <li>3</li> </ul> </div> </SmallSlot> </templa
阅读全文
摘要:App.vue <template> <ConpentA @paEvent="clickData"/> {{ mes }} </template> <script> import ConpentA from './components/ConpentA.vue'; export default{ d
阅读全文
摘要:Props 静态属性 <template> <div> <ConpentA title="我是静态props"/> </div> </template> <script> import ConpentA from './components/ConpentA.vue' export default
阅读全文
摘要:<template> <div> <div ref="username" >内容</div> <button @click="handleclick">按钮</buttom> </div> </template> <script> export default { methods:{ handlec
阅读全文
摘要:Axios 是一个基于 promise 的 HTTP 库,可以用在浏览器和 node.js 中 promise 是现代 javascript 中异步编程的基础,是一个由异步函数返回的可以向我们指示当前操作所处的状态的对象 使用 cdn: <script src="https://unpkg.com/
阅读全文
摘要:<script> new Promise((resolve,reject)=>{ console.log("11111111111111111"); setTimeout(()=>{ resolve("##################"); }) }).then(res=>{ console.l
阅读全文
摘要:ES6 promise解决异步回调地狱问题 $.get('index/api',function(data){ $.get('index/api1'+data.id,function(data){ ........ }) }) setTimeout(()=>{ console.log('第一层');
阅读全文
摘要:index.js import { createStore } from "vuex"; const store=createStore({ state:{ count:100 }, getters:{ compower(state){ return (id)=>state.count*id } }
阅读全文
摘要:index.js写法 import { createStore } from "vuex"; const store=createStore({ state:{ count:100 }, getters:{ compower(state){ return (id)=>state.count*id }
阅读全文
摘要:index.js 写法 import { createStore } from "vuex"; const store=createStore({ state:{ count:100 }, getters:{ compower(state){ return (id)=>state.count*id
阅读全文
摘要:1,createWebHistory 这种h5用法 localhost:// 2,createWebHashHistory 这种hash用法 路径会带# localhost:/#/
阅读全文
摘要:1,beforEach router.beforeach(to,from,next)=>{ console.log('1111') } 2,afterEach router.aftereach(to,from,next)=>{ console.log('222') }
阅读全文
摘要:在Vue3中,let、var和const都是用于声明变量的关键字区别: var:在JavaScript中,var是声明变量的最常用的关键字。var声明的变量的作用域是函数级的,如果在函数内部声明的变量,其作用域将限制在函数体内部。如果在函数外部声明的变量,则其作用域将是全局的。 let:let也用于
阅读全文