# uniapp-music **Repository Path**: duanli_666/uniapp-music ## Basic Information - **Project Name**: uniapp-music - **Description**: 教学项目 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-04-20 - **Last Updated**: 2023-06-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # uniapp-music #### 配置git ssh 公钥 ``` 在git bash中执行:ssh-keygen -t ed25519 -C "xxxxx@xxxxx.com" 在本地生成公钥和私钥 然后将公钥放在码云设置: 码云> 设置 > ssh ``` #### 在码云中创建一个项目仓库 项目名称: uniapp-music #### 通过git clone命令将项目克隆到本地 git clone ssh的地址 >git clone git@gitee.com:duanli_666/uniapp-music.git #### 通过hubuildX创建一个项目demo 然后将demo中的文件拖入到uniapp-music #### 将初始化项目提交到远程仓库 git add . 提交到暂存区 git commit -m "init project" git push #### 接口 推荐列表 >http://119.3.202.71:3000/api/getRecommend 歌手列表 > /api/getSingerList > /api/getAlbum 歌手详情页: > /api/getSingerDetail ### 懒加载 vue3-lazy - 在uniapp-music 目录下 执行npm init -y 初始化 - npm install vue3-lazy -S - npm install ### VueX的使用 1.首先安装vuex npm install vuex@next --save 2. 创建一个store文件夹 新建index.js用于创建 vuex的实例 store ``` // 定义一个store import { createStore} from 'vuex' // 创建一个store实例 let store = createStore({ state:{ message:"hello", age:12 }, mutations:{ changeMessage(state){ state.message = " vuex" }, changeAge(state){ state.age = 100; } } }) /* state 状态: 存储数据的地方 mutations 中存放的方法 changeAge 用于改变state中的数据 */ export default store; ``` 3、 在vue实例中注册store 在main.js中注册 import store from './store/index.js' app.use(store); 4、getters 相当于computed 计算属性 let store = createStore({ state:{ a:10, b:12 }, mutations:{ changeMessage(state, value){ }, changeAge(state){ } }, actions:{ changeMessage(context){ context.commit('changeMessage', "vuex" ); // commit 提交 表示执行mutations里面的changeMessage } }, getters:{ totle(state){ return state.a + state.b } } }) ablums {{ $store.getters.totle}} ### 歌词接口 ###