vue

1.app
// 将wx挂载到vue实例上
Vue.prototype.$wx = wx
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
// axios.defaults.headers.post['Content-Type'] = 'application/json'
 
Vue.prototype.$http = axios
router.beforeEach((to, from, next) => {
/* 路由发生变化修改页面meta */
if(to.meta.content){
let head = document.getElementsByTagName('head');
let meta = document.createElement('meta');
meta.content = to.meta.content;
head[0].appendChild(meta)
}
/* 路由发生变化修改页面title */
if (to.meta.title) {
document.title = to.meta.title;
}
// 处理jssdk签名,兼容history模式
if (!store.state.url) {
store.commit('setUrl', document.URL)
}
next()
});
 
 
let dateServer = value => {
  return value.replace(/(\d{4})(\d{2})(\d{2})/g, '$1-$2-$3')
}
export { dateServer }

/src/main.js

import * as custom from './common/filters/custom'

Object.keys(custom).forEach(key => {
  Vue.filter(key, custom[key])
})
posted @ 2019-01-14 16:29  半亩方塘dd  阅读(135)  评论(0)    收藏  举报