# cdxy **Repository Path**: professional-dog-beating-team/cdxy ## Basic Information - **Project Name**: cdxy - **Description**: 彩蛋校园 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-04-14 - **Last Updated**: 2021-05-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## vuex 使用 在script中引入 ```js import {mapState,mapMutations} from 'vuex'; ``` 然后mapState必须写在 computed中 ```js {{position}}//使用vuex中的值 export default { data() { return { address: "", } }, computed: mapState(['position', 'userData']) } ``` mapMutations写在methods里面 ```js methods: { ...mapMutations(['getPosition', 'getUserData']) }, //使用的话直接调用this.getPosition就可以了 ``` ## ajax请求使用 ```js methods: { dome:async function(){ let s = await this.$ajax('zhongxin','get',{}) // $ajax('路径','methods',参数}) console.log(s) } }, onShow() { this.dome() } ``` ### 5a4s56d456as4d564as5665