小编pas*_*ner的帖子

Express-session 未在浏览器中设置 cookie

所以我使用express-session包来设置cookie和会话。它还连接到我的 MongoDB 存储来存储会话。当用户登录时,会话会很好地存储在数据库中,但浏览器中没有 cookie。我的应用程序正在运行http://localhost:8080/,我的服务器正在运行http://localhost:5500/

索引.js:

const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const expressSession = require('express-session');
const mStore = require('./model/database.js').Mstore;
const routes = require('./control/router.js');
const mongooseConnect = require('./model/database.js').mongooseConnect;


app.use(
   expressSession({ 
      secret: 'my secret', 
      resave: false, 
      saveUninitialized: false,
      store: mStore
   }),
   bodyParser.urlencoded({ extended: true }),
   bodyParser.json(),
   routes
);


mongooseConnect(() => app.listen(process.env.PORT || 5500));
Run Code Online (Sandbox Code Playgroud)

路由器.js:

const express = require('express');
const router = express.Router();
const notesModel = require('../model/database.js').notesModel;
const userModel …
Run Code Online (Sandbox Code Playgroud)

mongodb session-cookies node.js express express-session

9
推荐指数
2
解决办法
1万
查看次数

无法激活纱线

我正在关注纱线安装文档。当我跑步时corepack prepare yarn@stable --activate,我得到了Usage Error: Invalid package manager specification in CLI arguments; expected a semver version。有人知道怎么回事吗?

node.js npm yarnpkg yarn-workspaces yarn-v2

7
推荐指数
1
解决办法
3664
查看次数

Vuetify - 如何自定义 <v-select> 中选项的样式?

我正在尝试找到一种自定义<v-select>选项样式的方法。backgroundColor我想根据选项的值提供不同的值。提供的所有内容都:items将被修复(始终相同),因此我需要找到一种方法来通过其特定文本值或声明唯一的类/id 来检测选项。对此最好的方法是什么?谢谢。

当前代码:

<v-select
   :items="[
      'This is yellow option', // Yellow background.
      'This is blue option', // Blue background.
      'This is grey option' // Grey background.
   ]"
>
</v-select>
Run Code Online (Sandbox Code Playgroud)

是我想要的结果示例的链接。

<v-select
   :items="[
      'This is yellow option', // Yellow background.
      'This is blue option', // Blue background.
      'This is grey option' // Grey background.
   ]"
>
</v-select>
Run Code Online (Sandbox Code Playgroud)
.yellow {
  background-color: yellow;
}

.blue {
  background-color: blue;
}

.grey {
  background-color: grey;
}
Run Code Online (Sandbox Code Playgroud)

javascript css vue.js material-design vuetify.js

4
推荐指数
1
解决办法
8078
查看次数

Vue.js &lt;transition-group&gt; 仅在最后一个元素上应用动画

我正在练习 Vue转换组并专门在这个特定部分模仿 Vue 文档示例。

问题是我的示例将仅在结束元素上应用动画,而不是在添加/删除的元素上应用动画。

有人可以解释一下我做错了什么吗?:( 谢谢。

这是该应用程序的链接以获取更多说明

<style>
<head>
body{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    font-family: 'Nunito', sans-serif;
    background-color: #101010;
    color: white;
    text-align: center;
}
.flex{display:flex;justify-content:center;}

.test-enter{
    opacity: 0;
    transform: translateY(-20px);
}
.test-enter-to{
    opacity: 1;
}

.test-leave-to{
    opacity: 0;
    transform: translateY(20px);
}

.test-enter-active,
.test-leave-active{
    transition: 0.5s ease;
}
</style>
</head>
<body>
<br>

<div id='app'>
    <button @click='shuffle'>Shuffle</button>
    <button @click='add'>Add</button>
    <button @click='remove'>Remove</button>
    <br><br>
    
    <transition-group name='test' class='flex'>
        <div v-for='(num, ind) in arr' …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vue-component vuejs2 vuejs-transition-group

3
推荐指数
1
解决办法
1477
查看次数

无法从 Vue 路由器链接中删除下划线

我想我尝试了几乎所有尝试从router-link.

这是我的代码:

<router-link :to="{name: 'Plan'}">
   <div>Plan Your Trip</div>
      <div class='expander'>
      <router-link :to="{name: 'Plan'}">COVID-19</router-link>
      <router-link :to="{name: 'Plan'}">Visa</router-link>
      <router-link :to="{name: 'Plan'}">Essentials</router-link>
   </div>
</router-link>
Run Code Online (Sandbox Code Playgroud)

我正在尝试仅从子链接中删除下划线。

我尝试过的事情:

内嵌样式

<router-link style="text-decoration: none !important;" :to="{name: 'Plan'}">COVID-19</router-link>
Run Code Online (Sandbox Code Playgroud)

分配班级

<router-link class="sub-link" :to="{name: 'Plan'}">COVID-19</router-link>

<style scoped>
   .sub-link{text-decoration: none !important;}
</style>
Run Code Online (Sandbox Code Playgroud)

声明标签

<router-link tag="div" :to="{name: 'Plan'}">COVID-19</router-link>

<style scoped>
   div{text-decoration: none !important;}
</style>
Run Code Online (Sandbox Code Playgroud)

为该标签分配单独的标签+声明类

<router-link :to="{name: 'Plan'}">
   <div class="sub-link">COVID-19</div>
</router-link>
Run Code Online (Sandbox Code Playgroud)

这些只是几个列表,我确实尝试了我能想到的所有可能的方法......我是否遗漏了自定义 Vue 的一些内容router-link

css vue.js vue-router vuejs2 routerlink

3
推荐指数
1
解决办法
905
查看次数