VUE+DJANGO

it2022-05-09  33

1.router类型不能设置为history

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

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

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

module.exports = { assetsDir:'./static/static/', #这个是生成样式存放的路径 publicPath:'', #这个才是链接前缀 '' ='./' }

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

4.退出参考

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

 

转载于:https://www.cnblogs.com/CGCong/p/10845703.html

相关资源:Vue Django实现电子商务网站

最新回复(0)