npm install xe-utils vxe-utils --save
经由过程 Vue.use() 来全局装置
import Vue from 'vue'
import XEUtils from 'xe-utils'
import VXEUtils from 'vxe-utils'
// mounts 能够设置['cookie', 'browse', 'locat']
Vue.use(VXEUtils, XEUtils, {mounts: ['cookie']})
运用
<template>
<div>{{ $utils.toDateString(startDate, 'yyyy-dd-MM HH:mm:ss') }}</div>
<div>{{ endDate }}</div>
</template>
<script>
export default {
name: 'App',
data: {
return {
startDate: new Date(),
endDate: null
}
},
created () {
this.endDate = this.$utils.toDateString(new Date(), 'MM/dd/yyyy HH:mm:ss.SSS')
}
}
</script>