上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 97 下一页
摘要: 一、配置路由 关键字 children 注意 子路由 path 不加斜杠 src/router/index.js export default new VueRouter({ routes:[ { // path 是路径,component是组件 path: '/about', component: 阅读全文
posted @ 2025-01-08 14:49 市丸银 阅读(33) 评论(0) 推荐(0)
摘要: 1、安装vue-router //Vue2 npm i vue-router@3 //vue3 npm i vue-router 2、使用VueRouter main.js // 引入VueRouter import VueRouter from "vue-router"; //使用 Vue.use 阅读全文
posted @ 2025-01-08 11:51 市丸银 阅读(18) 评论(0) 推荐(0)
摘要: 1、在pbulic文件夹中创建css文件夹,并存入bootstrap.css文件 2、在index.html文件中引入 <link rel="stylesheet" href="<%= BASE_URL %>css/bootstrap.css"> 阅读全文
posted @ 2025-01-08 11:07 市丸银 阅读(7) 评论(0) 推荐(0)
摘要: 1、创建Js文件 每个组件单独一个js文件,在src/sore中 2、每个组件文件中,默认暴露,actions mutations state gettters namespaced:true export default { namespaced: true, actions:{}, mutati 阅读全文
posted @ 2025-01-08 10:31 市丸银 阅读(18) 评论(0) 推荐(0)
摘要: 1、actions addPersonApi(context){ axios.get('https://random-data-api.com/api/name/random_name').then( response=>{ context.commit('ADD_PERSON', {id:nano 阅读全文
posted @ 2025-01-08 10:15 市丸银 阅读(4) 评论(0) 推荐(0)
摘要: 一、模块化 1、几个组件定义几个对象 文件 src/store/index.js // 与count组件相关的optinos const countOptions = { actions:{}, mutations:{}, state:{}, getters:{} } // 与person组件 相关 阅读全文
posted @ 2025-01-08 08:41 市丸银 阅读(41) 评论(0) 推荐(0)
摘要: 使用state和mapState,轻松实现多组件间数据共享 阅读全文
posted @ 2025-01-07 22:19 市丸银 阅读(11) 评论(0) 推荐(0)
摘要: 1、安装 npm i nanoid 2、引入 import {nanoid} from 'nanoid' 3、使用 nanoid() 阅读全文
posted @ 2025-01-07 22:07 市丸银 阅读(40) 评论(0) 推荐(0)
摘要: 一、mapMutations 1、作用:帮助我们生成与mutations对话的方法,即包含 $store.commit() 2、步骤 a、引入 import {mapActions, mapMutations} from 'vuex' b、语法 methods:{ // mapMutations生成 阅读全文
posted @ 2025-01-07 21:40 市丸银 阅读(210) 评论(0) 推荐(0)
摘要: 一、作用 生成计算属性,简化模版{{xx}}xx的写法,原因xx在vuex中写法麻烦$store.state.x或$store.getters.x 二、步骤 1、引入 import {mapState, mapGetters} from 'vuex' 2、语法 computed:{ // 借助 ma 阅读全文
posted @ 2025-01-07 21:02 市丸银 阅读(31) 评论(0) 推荐(0)
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 97 下一页