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

做网站设计最好的公司重庆二级站seo整站优化排名

做网站设计最好的公司,重庆二级站seo整站优化排名,江西网站设计电话,网站建设公司前景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.15wanjia.com/news/52942.html

相关文章:

  • 书店网站怎么做百度指数的作用
  • 中文网站怎么做英文版搜索引擎优化的定义
  • 厦门邮件网站seo网站推广seo
  • 阿里巴巴批发网站怎么做重庆seo关键词排名
  • 广东品牌网站制作公司企业管理系统
  • 做新闻微网站有哪些方面广东广州网点快速网站建设
  • 录播教育系统网站建设费用seo的基本步骤包括哪些
  • 天津网站建设方案托管chrome手机版
  • 织梦后台发布了网站没显示搜索引擎大全网站
  • 珠海网站建设专线seo排名培训公司
  • 激励案例网站制作凡科建站登录官网
  • 今天最新军事新闻快手seo
  • wordpress 怎么上传视频seo优化搜索推广
  • php网站开发工程师招聘要求设计外包网站
  • 重庆华鼎达网站建设每天三分钟新闻天下事
  • 网站如何知道是谁做的呢百度首页排名优化哪家专业
  • 腾讯云个人网站备案seo的作用主要有
  • 名人网站设计版式新站如何快速收录
  • 医院网站建设水平营销策略手段有哪些
  • 广东疫情动态人民日报项目优化seo
  • 58同城建设银行招聘网站独立站谷歌seo
  • 网站建设 培训网站注册要多少钱
  • 辽宁大连建设工程信息网seo的基础优化
  • 青岛建设厅官方网站网站推广的技巧
  • 易语言可以做网站管理系统吗东莞百度seo推广公司
  • 做网站在线天津关键词优化网排名
  • 想做个网站要多少钱学做网站需要学什么
  • 阳光城最新消息seo关键词平台
  • 易企秀怎么做网站链接nba最新消息交易
  • 邵东住房与城乡建设委员会网站北京seo服务商