diff --git a/Miscellaneous/mongoDB.md b/Miscellaneous/mongoDB.md index 967e5e7..7dcbaa4 100644 --- a/Miscellaneous/mongoDB.md +++ b/Miscellaneous/mongoDB.md @@ -40,6 +40,7 @@ security: mongo --port 12236 -u "admin" -p "rqRrjTDaq9" --authenticationDatabase "admin" //方法二 db.auth("yingbo", "623910ert") +db.auth("yiban", "623910ert") db.auth("admin", "rqRrjTDaq9") ``` diff --git a/Miscellaneous/vue.md b/Miscellaneous/vue.md index 1aed43c..d949279 100644 --- a/Miscellaneous/vue.md +++ b/Miscellaneous/vue.md @@ -1,3 +1,43 @@ # VUE个人积累 -使用VUE-cli创建的项目发布之前必须将 config/index.js 中 build 下的 productionSourceMap: true, 改为 productionSourceMap: false, 否则生产环境中可以看见所有的源码 \ No newline at end of file +使用VUE-cli创建的项目发布之前必须将 config/index.js 中 build 下的 productionSourceMap: true, 改为 productionSourceMap: false, 否则生产环境中可以看见所有的源码 + +## vue-cookies + +安装 + +`npm install vue-cookies --save` + +使用 + +```js +import VueCookies from 'vue-cookies' +Vue.use(VueCookies) +``` + +Api + + 设置 cookie `this.$cookies.set(keyName, time) //return this` + + 获取 cookie `this.$cookies.get(keyName) // return value` + + 删除 cookie `this.$cookies.remove(keyName) // return false or true , warning: next version return this; use isKey(keyname) return true/false,please` + + 查看一个cookie是否存在(通过keyName)`this.$cookies.isKey(keyName) // return false or true` + + 获取所有cookie名称 `this.$cookies.keys() // return a array` + +## nginx 配置 + +在vue路由模式为history的时候,刷新页面会出现404问题。我们只需要在服务器配置如果URL匹配不到任何静态资源,就跳转到默认的index.html。 + +``` +server { + listen 8105; // 表示你nginx监听的端口号 + root /home/admin/sites/vue-nginx/dist; // vue打包后的文件夹dist目录 + index index.html; + location / { + try_files $uri $uri/ /index.html; + } +} +``` \ No newline at end of file