main.js文件中 import Vue from 'vue' import 'normalize.css/normalize.css' // A modern alternative to CSS resets import ElementUI from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' import '@/styles/index.scss' // global css import App from './App' import store from './store' import router from './router' import Moment from 'moment'; import '@/icons' // icon import '@/permission' // permission control import "@/styles/Common.scss"; import global_ from '@/components/Global';//引用文件 import CommonJs from "@/utils/Common.js"; if (process.env.NODE_ENV === 'production') { const { mockXHR } = require('../mock') mockXHR() } Vue.prototype.GLOBAL = global_;//挂载到Vue实例上面 Vue.prototype.moment = Moment;//引用时间控件 Vue.prototype.CommonJs = CommonJs;//引用公共js文件 Vue.use(ElementUI);
Vue.config.productionTip = false Vue.filter('dateYMDFormat',function(dateStr,pattern='YYYY-MM-DD'){ return Moment(dateStr).format(pattern); }) new Vue({ el: '#app', router, store, render: h => h(App) }) 页面中 <el-table-column prop="TreatmentTime" label="治疗时间" align="center"> <template slot-scope="scope"> {{ scope.row.TreatmentTime | dateYMDFormat }} </template> </el-table-column>
|