当前位置: 首页 > news >正文

文化体育局网站建设南昌百度快速排名优化

文化体育局网站建设,南昌百度快速排名优化,网站的策划方案,珠海的网站建设el-upload组件 支持多种风格,如文件列表,图片,图片卡片,支持多种事件,预览,删除,上传成功,上传中等钩子。 file-list:上传的文件集合,一定要用v-model:file-…

el-upload组件 支持多种风格,如文件列表,图片,图片卡片,支持多种事件,预览,删除,上传成功,上传中等钩子。
在这里插入图片描述

在这里插入图片描述
file-list:上传的文件集合,一定要用v-model:file-list进行双向绑定。
list-type:决定文件类型,filelist,picture,picture-card 3种

用法示例

vue代码

<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import type { FormInstance,FormRules,UploadUserFile  } from 'element-plus'interface Good {}const goodForm=ref<Good>({});const fileList=ref<UploadUserFile[]>()const picFileList=ref<UploadUserFile[]>()const picCardFileList=ref<UploadUserFile[]>()const previewDialogVisable=ref(false)
const previewPicUrl=ref()const previewFunc = (uploadFile:UploadUserFile)=>{previewDialogVisable.value=truepreviewPicUrl.value=uploadFile.url
}</script><template><el-form :model="goodForm" status-icon label-position="left" label-width="auto" ref="formRef"><el-form-item label="select file"><el-upload v-model:file-list="fileList" action="http://localhost:3000/upload"><template #trigger><el-button type="primary">select file</el-button></template></el-upload></el-form-item><el-form-item label="select pic file"><el-upload v-model:file-list="picFileList" list-type="picture" action="http://localhost:3000/upload"><template #trigger><el-button type="primary">select file</el-button></template></el-upload></el-form-item><el-form-item label="picture card file"><el-upload v-model:file-list="picCardFileList" action="http://localhost:3000/upload" list-type="picture-card" :on-preview="previewFunc"><template #trigger><el-button type="primary">select file</el-button></template></el-upload></el-form-item><el-dialog v-model="previewDialogVisable" ><img :src="previewPicUrl"  alt="preview image" w-full/></el-dialog></el-form></template><style scoped></style>

后端用node+ts

import express from 'express';
import multer from 'multer';
import path from 'path';
import cors from 'cors';// 初始化 express 应用
const app = express();app.use(cors())// 设置文件存储配置
const storage = multer.diskStorage({destination: (req, file, cb) => {cb(null, 'uploads/'); // 文件存储目录},filename: (req, file, cb) => {const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1E9);cb(null, file.fieldname + '-' + uniqueSuffix + path.extname(file.originalname)); // 文件名}
});const upload = multer({ storage: storage });// 创建文件上传路由
app.post('/upload', upload.single('file'), (req, res) => {res.send({message: 'File uploaded successfully',file: req.file});
});app.use(express.static(path.join(__dirname, '../uploads')));// 启动服务器
const PORT = 3000;
app.listen(PORT, () => {console.log(`Server is running on http://localhost:${PORT}`);
});

在这里插入图片描述

demo 地址
https://github.com/haozhi-ly/elment-plus-demo

https://element-plus.org/zh-CN/component/upload.html#%E5%B1%9E%E6%80%A7

http://www.yayakq.cn/news/658753/

相关文章:

  • 网站源码交易平台网页制作首页
  • 五通桥移动网站建设wordpress 轮播图代码
  • wordpress 跨站调用求html码源网站
  • 宁波网站建设营销定制m3u8插件 wordpress
  • 搜索引擎的网站免费域名主机
  • 建设淘宝网站的市场分析凡科网账号怎么注销
  • 无锡网站建设服务公司武义建设工程网站
  • .net建网站的优势网站建设和数据容量整合
  • 网站开发维护的工作职责网站建设套餐怎么样
  • 变性人做欲网站深圳市工程交易服务中心
  • 网站备案表不会写旅游景区网站建设的意义
  • html企业网站怎么做白杨seo
  • 数字资产币币交易所网站开发免费ppt模板免费网站
  • 网站做交叉连接网络营销师是什么
  • 自主建站系统html代码软件
  • 网站内容创意网站标签图片修改
  • 网站开发调查问卷wordpress文章筛选
  • 视频优化网站怎么做义乌市建设银行网站
  • 哪里网站备案com网站免费注册
  • 山东城市建设学院网站wordpress云落主题
  • 百度站长统计电子商务网站建设怎么做
  • 廉政网站建设在婚恋网站做翻译好吗
  • 深圳市城乡建设部网站首页搭建商城哪家好怎么样
  • 建设网站怎么制作酒吧网站模板
  • 湖北网站推广系统网站开发编程语言
  • 互联网技术网站有什么教做甜品的网站
  • 佟年给韩商言做的网站外贸网站推广哪家好
  • 如何运营好一个网站金点子创业项目
  • php 遍历网站微网站设计方案
  • 二手交易平台 网站开发视觉网络网站