把Cmder添加到右键
找到安装包,以管理员身份运行并执行代码
cmder /register all
淘宝镜像的安装
npm i -g cnpm --registry=https://registry.npm.taobao.org
当前页面路由替换
- 替换当前页面
this.$router.replace('/home')
- 新开一个页面
let routeData = this.$router.resolve({
path: 'test',
query: {
sign: this.$route.query.sign,
idSign: examinationId,
recordId: id,
},
})
window.open(routeData.href, '_blank')
vuex-router-sync
卸载全局依赖
npm uninstall -g <package>
URL.createObjectURL(适应后台给你返回一张图片,你需要渲染到页面时)
URL.createObjectURL: 根据传入的参数创建一个指向该参数对象的URL.
objectURL = URL.createObjectURL(blob)URL.revokeObjectURL(objectURL): 释放一个通过URL.createObjectURL()创建的对象URL.
vue项目中使用
// state.js
qrImage: null, // 二维码
//mutaion-type.js
export const GET_QR_IMAGE = 'GET_QR_IMAGE'
//mutaion.js
[types.GET_QR_IMAGE](state, { qrImage }) {
state.qrImage = window.URL.createObjectURL(qrImage)
},
//actions.js
async getQrImage({ commit }) {
const res = await this.$ajax.getBlob(this.$apis.getQrImage, true, {
throttle: 'qrImage',
})
if (res.ok) {
commit({
type: types.GET_QR_IMAGE,
qrImage: res.data,
})
}
},
//index.js
<template>
<div>
<img :src="getImgUrl" alt="">
</div>
</template>
<script>
import { mapActions, mapState } from 'vuex'
export default {
computed: {
...mapState('member', {
qrImage: state => state.qrImage
}),
getImgUrl() {
return this.qrImage
}
},
methods: {
...mapActions('member', ['getQrImage']),
},
created() {
this.getQrImage()
},
}
</script>
解决Vue中页面跳转不会回到首页的bug
const router = new Router({
routes,
scrollBehavior(to, from, savedPosition) {
// return 期望滚动到哪个的位置
return { x: 0, y: 0 }
},
})
码云重置密码
git config --system --unset credential.helper