VUE+DJANGO

1.router类型不能设置为history

const router = new Router({
  mode: '',
  routes,
});
//避免打包到django后刷新报错

2.样式放static里面,适配django

3.在根目录新建vue.config.js

module.exports = {
  assetsDir:'./static/static/',
}

更多配置可参考:https://cli.vuejs.org/zh/config/#publicpath

4.退出参考

window.location.href = './account/logout/'

猜你喜欢

转载自www.cnblogs.com/CGCong/p/10845703.html