当前位置: 首页 > 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.dinnco.com/news/18631.html

相关文章:

  • 4秒网站建设百度推广一年大概多少钱
  • 网络广告类型刷seo关键词排名软件
  • 做30个精品网站宣传渠道有哪些
  • 网站建设教程费用化工seo顾问
  • 比百度更好的网站安卓手机游戏优化器
  • 固原网络营销网络推广方案seo深度解析
  • 做水果的网站有哪些优化的含义是什么
  • 写手机版网站的静态页面现在做网络推广好做吗
  • 个性化网站建设多少钱湖南seo优化按天付费
  • 网站开发 毕业论文搜索百度
  • 搭配服装网站源码网站如何推广营销
  • php中英文网站百度网页版浏览器入口
  • 小程序制作需要多少钱一个南通百度seo代理
  • 狗铺子做网页在那个网站百度广告推广怎么收费了
  • wordpress优化数据库变大信息流优化师培训
  • 政府网站开发需求报告网络营销软件哪个好用
  • 2021年建站赚钱树枝seo
  • 广东高端网站设计公司价格关键词难易度分析
  • wordpress 网站优化景德镇seo
  • 怎么制作网站教程图片快速建站网站
  • 给企业做网站的公司西安信息推广平台
  • 经营阅读网站需要怎么做搜索引擎搜索
  • 提供服务器和网站建设潍坊快速网站排名
  • 为什么我自己做的网站百度不到关键词采集网站
  • 厦门网站建设的公司哪家好整站优化代理
  • 沈阳做网站比较好的公司2023b站推广大全
  • 门户网站建设 请示20条优化措施
  • 网站英文域名怎么查青岛网站建设方案
  • 小说网站流量怎么做seo网站推广软件 快排
  • wordpress 设置文章模板seo是什么