angular.js - 第一次做单页应用(SPA),有些问题不太明白应该如何处理
PHP中文网
PHP中文网 2017-05-15 17:02:45
0
1
685

在使用vue webpack构建单页应用,有几个问题不太清楚。

1,用户授权、登录状态如何处理?

2,单页应用中cookie是否并没有什么用途了?

3,webpack编译出来的dist目录,里面的index.html和静态文件是直接用nginx跑吗?

4,有没有详细点的webpack资料,官网一般只解释了各个配置的意思但没有演示,很多配置项只能看懂却不理解也不会用

目前主要疑点在第1个问题,望大神解答

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
Ty80

1 + 2: After all, the maintenance of login status is nothing more than letting the client get a token that represents your login session after logging in. If you can get this, you will understand that it can actually be done by various means. It’s just one of the implementation options. So the key to this is that you handle the login well, and after logging in, the server registers a new token and issues the token to the client. As for the storage on the client side, it depends on your implementation, cookie / localStorage is fine, or you can simply use js variables to maintain it (if you don’t mind losing the state after refreshing)

3 - Yes, but if you use historyState, then configure try_files (or/and rewrite) so that the URLs are processed correctly

4 - This question is too general, search the documentation if needed

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template