全局创建.prettierrc文件
注:一定要全局,即放在根目录
内容可以自己另外添加
{
“swmi”:false,
“singleQuote”: true
}
然后使用快捷键格式化就不会产生冲突
退出功能实现
Home.js页面
<template>
<div>
<el-button @click="loginout" type="info">退出</el-button>
</div>
</template>
<script>
export default {
methods: {
loginout () {
// 清空token
window.sessionStorage.clear()
// 跳转到登录页
this.$router.push('/login')
}
}
}
</script>
<style lang="less" scoped>
</style>