-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 删除部分app.config.globalProperties变量
- Loading branch information
Showing
12 changed files
with
248 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
import mitt from 'mitt'; | ||
import api from '@/api'; | ||
import { checkRes } from '@/utils/util'; | ||
|
||
export default { | ||
install(app) { | ||
app.config.globalProperties.checkRes = checkRes; | ||
app.config.globalProperties.$api = api; | ||
app.config.globalProperties.$bus = mitt(); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
function validateRefs(refs) { | ||
refs = refs || Object.keys(this.$refs); | ||
const errors = refs.filter((ref) => this.$refs[ref] && 'validate' in this.$refs[ref] && typeof this.$refs[ref].validate === 'function').map((ref) => this.$refs[ref].validate()).filter((val) => !!val); | ||
return errors.length ? errors : null; | ||
} | ||
|
||
async function checkForm(form = 'form') { | ||
return new Promise((res) => { | ||
this.$refs[form].validate((valid) => { | ||
res(valid); | ||
}); | ||
}); | ||
} | ||
function resetForm(form = 'form') { | ||
this.$nextTick(() => { | ||
this.$refs[form].resetFields(); | ||
}); | ||
} | ||
|
||
function checkRes(res) { | ||
return (res && res.data && res.data.code === 0); | ||
} | ||
|
||
function signOut(href = '') { | ||
window.localStorage.removeItem('token'); | ||
window.location.href = href; | ||
} | ||
|
||
export { | ||
validateRefs, | ||
checkRes, | ||
checkForm, | ||
resetForm, | ||
signOut, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.