上一页 1 2 3 4 5 6 ··· 22 下一页
摘要: 1. 配置路由规则,使用children配置项: ```js routes:[ { path:'/about', component:About, }, { path:'/home', component:Home, children:[ //通过children配置子级路由 { path:'new 阅读全文
posted @ 2023-09-06 23:28 雪落无痕1 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1. 路由组件通常存放在```pages```文件夹,一般组件通常存放在```components```文件夹。 2. 通过切换,“隐藏”了的路由组件,默认是被销毁掉的,需要的时候再去挂载。 3. 每个组件都有自己的```$route```属性,里面存储着自己的路由信息。 4. 整个应用只有一个ro 阅读全文
posted @ 2023-09-06 22:50 雪落无痕1 阅读(1) 评论(0) 推荐(0) 编辑
摘要: ### 1.基本使用 1. 安装vue-router,命令:```npm i vue-router``` 2. 应用插件:```Vue.use(VueRouter)``` 3. 编写router配置项: ```js //引入VueRouter import VueRouter from 'vue-r 阅读全文
posted @ 2023-09-05 23:45 雪落无痕1 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1. vue-router 的理解 vue 的一个插件库 专门用来实现SPA 应用 2.SPA 应用的理解 单页web 应用,(single page web application SPA) 整个页面只有一个完整的页面 点击页面中的导航链接不会刷新页面 只会做页面的局部更新 数据需要通过ajax 阅读全文
posted @ 2023-09-04 23:39 雪落无痕1 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 7.模块化+命名空间 1. 目的:让代码更好维护,让多种数据分类更加明确。 2. 修改```store.js``` ```javascript const countAbout = { namespaced:true,//开启命名空间 state:{x:1}, mutations: { ... }, 阅读全文
posted @ 2023-09-03 01:08 雪落无痕1 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 1.Person.vue <template> <div> <h1>人员列表</h1> <h1 style="color: red;">Count 组件的求和为{{ sum }}</h1> <input type="text" placeholder="请输入名字" v-model="name">< 阅读全文
posted @ 2023-08-29 00:52 雪落无痕1 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 1. Count.vue <template> <div> <h1>当前求和位{{ sum}}</h1> <h1>当前求和放大10倍后是{{ bigSum }}</h1> <h1>我在{{school }},学习{{ subject }}</h1> <select v-model.number="n 阅读全文
posted @ 2023-08-28 22:48 雪落无痕1 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 1. 概念:当state中的数据需要经过加工后再使用时,可以使用getters加工。 2. 在```store.js```中追加```getters```配置 ```js ...... const getters = { bigSum(state){ return state.sum * 10 } 阅读全文
posted @ 2023-08-27 01:54 雪落无痕1 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 1. 初始化数据、配置```actions```、配置```mutations```,操作文件```store.js``` ```js //引入Vue核心库 import Vue from 'vue' //引入Vuex import Vuex from 'vuex' //引用Vuex Vue.use 阅读全文
posted @ 2023-08-27 01:25 雪落无痕1 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1.store/index.js //改文件用于创建vuex 最为核心的 store import Vue from 'vue' //引入vuex import Vuex from 'vuex' Vue.use(Vuex) // 准备actions 用于响应组件中的动作 const actions= 阅读全文
posted @ 2023-08-27 01:24 雪落无痕1 阅读(5) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 22 下一页