基本上,每当我在我的 handleDelete 函数中删除一个项目时,它都会返回到主页,我想显示一条消息,说明您的产品已成功删除约 5 秒钟。
在我的 index.js 中,我首先将 message 设置为 false。并且在我的 ProductAttribute 中,每当我单击它时,设置的消息将为 true,并将在我的 UI 中的 Index.js/ 中显示该消息。
我的 handleDelete 函数
import React, { useState } from "react";
import { Header, Button, Modal } from "semantic-ui-react";
import axios from "axios";
import baseUrl from "../../utils/baseUrl";
import { useRouter } from "next/router";
function ProductAttributes({ description, _id }) {
const [modal, setModal] = useState(false);
const router = useRouter();
async function handleDelete() {
const url = `${baseUrl}/api/product`;
const payload = { params: { _id …Run Code Online (Sandbox Code Playgroud) 我有一个具有这些数字的特定用户的角色。
我在用q-table
<q-table
flat
bordered
title="USERS"
:data="allUsers"
:columns="columns"
:filter="filter"
:pagination.sync="initialPagination"
row-key="id"
>
<template v-slot:top-right>
<q-input
outlined
dense
debounce="300"
placeholder="Search"
v-model="filter"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<div class="q-pa-sm q-gutter-sm"></div>
<q-btn
outline
color="white"
text-color="black"
@click="openCreateUserModal"
label="Create Users"
/>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td
v-for="col in props.cols.filter(col => col.name !== 'actions')"
:key="col.name"
>
{{ col.value }}
</q-td>
<td key="actions">
<q-btn dense flat color="primary" field="edit" icon="edit" />
<q-btn
dense
flat
color="negative"
field="delete"
icon="delete" …Run Code Online (Sandbox Code Playgroud)