Create a new folder called plugins under the src/ folder of the vue project, and then create a new md5.js file under plugins/, and write the following code
In the src/main.js file of the vue project, write the following code
import md5 from'./plugins/md5'
Vue.use(md5)
use in component
<template><div class="inventoryRecord"><h1>{
{
msg }}</h1></div></template><script>exportdefault{
name:'inventoryRecord',data(){
return{
msg:'Welcome to Your Vue.js App商品库存编辑记录',passWord:'123456'}},mounted(){
let data =this.$md5(this.passWord)
console.log(data)// e10adc3949ba59abbe56e057f20f883e}}</script><!-- Add "scoped" attribute to limit CSS to this component only --><style scoped></style>