大家好,我正在尝试在 Nuxt.js 中创建动态“面包屑”,有没有人有一个工作示例,它应该如何工作
我尝试创建一个简单的示例,但它没有按预期工作,有人有可行的解决方案吗?
<template>
<div class="breadcrumbs-component-wrapper">
<b-breadcrumb class="breadcrumbs-holder">
<b-breadcrumb-item
v-for="(item, i) in breadcrumbs"
:key="i"
:to="item.name"
>
Test
</b-breadcrumb-item>
</b-breadcrumb>
</div>
</template>
<script>
export default {
computed: {
breadcrumbs() {
console.log( this.$route.matched);
return this.$route.matched;
},
},
};
</script>
Run Code Online (Sandbox Code Playgroud) 我想在 React 中为 Post 创建编辑表单,所以我的工作流程是获取帖子,设置表单的状态,然后显示它...我试图在功能组件中创建它,因为我很容易在那里使用 graphql
import React, { useState } from 'react';
import gql from 'graphql-tag';
import { useQuery } from '@apollo/react-hooks';
import useForm from 'react-hook-form';
const GET_POST = gql`
query getPost($id: String!) {
getPost(id: $id) {
id
title
content
excerpt
author {
name
}
}
}
`;
const EditPost = (props) => {
// here Im using postId to fetch post
const PostID = props.history.location.state.id;
// Im using react-hook-form
const { register, errors, reset, handleSubmit } = useForm(); …Run Code Online (Sandbox Code Playgroud) 嗨,我正在阅读 TypeORM 文档,并试图实现像这里显示的关系我试图拥有与每个用户相关的历史模型,以便每个用户都有多个历史记录
我正在阅读并使用该示例:
https://github.com/typeorm/typeorm/blob/master/docs/many-to-one-one-to-many-relations.md
但是在尝试实现它之后,我得到了 History 模型上的列 userId 不存在??
有谁知道可能是什么问题?
我假设我应该在我的模型的迁移文件中添加关系,但我在文档中没有看到任何这些?
如何使用路由和文件夹结构在 URL 中传递多个可选参数?我应该创建什么文件夹结构来处理路由类似的情况
user/:id/:product
user/:id/product/:id
Run Code Online (Sandbox Code Playgroud) 大家好,我有一个关于使用 sequalize 的快速问题。我创建了用户模型,它有字段电子邮件,它对这样的电子邮件进行了验证
module.exports = (sequelize, DataTypes) => sequelize.define('user', {
name: {
type: DataTypes.STRING,
},
phone: {
type: DataTypes.STRING,
},
email: {
type: DataTypes.STRING,
validate: {
isEmail: true,
},
},
});
Run Code Online (Sandbox Code Playgroud)
但有时在我的应用程序中,我想创建没有电子邮件的用户,或者将电子邮件创建为空字符串......但验证不允许我......在某些情况下有什么方法可以允许将空字符串保存为电子邮件,但是在其他人中运行验证???
伙计们,我正在尝试使用 net.Socket 包制作简单的 TCP 服务器,我正在使用express 框架。我试图实现的行为是当用户输入特定路由将数据发送到所有连接的客户端时,现在没有人可以实现这一点吗?
这是我的示例代码:
const express = require('express');
const app = express();
const cors = require('cors');
const bodyParser = require('body-parser');
const net = require('net');
const PORT = 5000;
let connection;
const server = net.createServer((socket) => {
console.log('CONNECTED: ' + socket.remoteAddress +':'+ socket.remotePort);
connection = socket;
});
app.use(cors());
app.use(bodyParser.json());
app.get('/', (request, response) => {
response.send('VMS server');
});
app.post('/contact', (req, res) => {
const data = { hello: 'hello' }
connection.write(data);
res.send({ data: 'data emmited' })
});
app.listen(PORT, () …Run Code Online (Sandbox Code Playgroud) 当未提供 v-model 但我们有 @input & value 时,我在 v-for & 内进行 vee-validate 和验证时遇到问题
这是我的 CodeSandbox 链接:
https://codesandbox.io/s/pective-williamson-8nkou
我想要生成的是验证添加到列表中的每个新行,当用户在 TextArea 中键入内容时,我想进行验证吗?
vue.js ×3
node.js ×2
nuxt.js ×2
sequelize.js ×2
express ×1
postgresql ×1
react-hooks ×1
reactjs ×1
socket.io ×1
sockets ×1
typeorm ×1
vee-validate ×1
vue-router ×1