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

最有效的网站推广方法网站建设浙江公司

最有效的网站推广方法,网站建设浙江公司,友情链接怎么做,如何提高网站的访问速度这里创建项目就不多说了 安装element-plus npm install element-plus 安装vuedraggable npm install vuedraggable 安装ali-oss npm install ali-oss 这里是封装一下#xff1a;在components创建文件夹jc-uploadjc-upload.vue 在封装的过程中遇到了一个问题就是dr…这里创建项目就不多说了 安装element-plus npm install element-plus 安装vuedraggable npm install vuedraggable 安装ali-oss npm install ali-oss 这里是封装一下在components创建文件夹jc-uploadjc-upload.vue 在封装的过程中遇到了一个问题就是draggable和el-upload上传按钮独占一行显然不是我们需要的效果先看问题 百度了一下没有找到什么解决办法这里通过一行css解决以上问题如有大佬有更好的方案可以分享一下 .draggable-container {display: contents;} 完整代码 templatediv classupload-containerdraggable classdraggable-container v-modelnewsFileList itemKeyurl ghost-classghost animation300template #item{ element }ul classel-upload-list el-upload-list--picture-cardli :keyelement.url classel-upload-list__item is-success animatedimg classel-upload-list__item-thumbnail :srcelement.url altlabel classel-upload-list__item-status-labeli classel-icon el-icon--upload-success el-icon--checksvg xmlnshttp://www.w3.org/2000/svg viewBox0 0 1024 1024path fillcurrentColordM406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z/path/svg/i/labeli classel-icon-close/ispan classel-upload-list__item-actions!-- 预览 --span classel-upload-list__item-previewclickhandlePictureCardPreview(element)i classel-icon el-icon--zoom-insvg xmlnshttp://www.w3.org/2000/svg viewBox0 0 1024 1024path fillcurrentColordm795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zm-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64h96z/path/svg/i/span!-- 删除 --span classel-upload-list__item-delete clickhandleRemove(element)i classel-icon el-icon--zoom-insvg xmlnshttp://www.w3.org/2000/svg viewBox0 0 1024 1024path fillcurrentColordM160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z/path/svg/i/span/span/li/ul/template/draggableel-upload refuploadRef :show-file-listfalse :classnewsFileList.length limit ? upload-hide : :actionaction :acceptaccept list-typepicture-card :file-listnewsFileList :on-removehandleRemove :on-successonSuccess :limitlimit:disableddisabledwith-credentials :multiplelimit 1? true : falsedragel-iconPlus //el-icon/el-uploadel-dialog v-modeldialogVisibleimg classuy-w-p-100 w-full :srcdialogImageUrl altPreview Image //el-dialog/div /templatescript langts setup import { reactive, ref, watch } from vue import { ElNotification, type UploadFile } from element-plus import OSS from ali-oss; import draggable from vuedraggable;const $emit defineEmits([success])/*** 组件props*/ const props defineProps({action: {type: String,// default: ${import.meta.env.VITE_SERVE}/api/Osstoken/getTokendefault: /api/api/Osstoken/getToken},fileList: {type: Array as () UploadFile[],default: () []},limit: {type: Number,default: 1},accept: {type: String,default: image/*},disabled: {type: Boolean,default: false} })// data数据 const uploadRef ref() const dialogImageUrl ref() const dialogVisible ref(false) const disabled ref(false) let newsFileList ref(props.fileList);// methods方法 const handleRemove (file: UploadFile) {const index newsFileList.value.findIndex(item item.url file.url);newsFileList.value.splice(index, 1);$emit(success, newsFileList) };const handlePictureCardPreview (file: UploadFile) {dialogImageUrl.value file.url!dialogVisible.value true };const uploadAliyun async (res: any, file: UploadFile, fileList: UploadFile[]) {if (res.code 0) {let date new Date();let year date.getFullYear();let month date.getMonth() 1;let day date.getDate();let formattedMonth month.toString().padStart(2, 0);let formattedDay day.toString().padStart(2, 0);const filePath /uploads/${year}/${formattedMonth}/${formattedDay}/${Date.parse(date.toString()) parseInt((Math.random() * (100000 - 10000 1) 10000).toString(), 10).toString()}.${file.raw?.name.split(.).pop()}let client new OSS({accessKeyId: res.data.AccessKeyId, //OSS的用户名accessKeySecret: res.data.AccessKeySecret, //OSS密钥region: res.data.region, //域名是创建Buckiet时选择的服务器地址 比如选择 华南3广州oss-cn-guangzhoubucket: res.data.bucket, //创建Buckiet的名称stsToken: res.data.SecurityToken //临时Token})const put async () {try {const result await client.put(filePath, file.raw!);if(result.res.status 200) {if(props.accept video/*) {file.url (result.res as any).requestUrls[0] ?x-oss-processvideo/snapshot,t_0,f_jpg;}newsFileList.value.push({url: (result.res as any).requestUrls[0],name: ,status: success,uid: 0})$emit(success, newsFileList)}} catch (err) {ElNotification.success({ message: 上传失败~ });}}put();} else {ElNotification.success({ message: res.msg });} };const onSuccess (res: any, file: UploadFile, fileList: UploadFile[]) {uploadAliyun(res, file, fileList) };watch(() props.fileList, (newVal) {newsFileList.value newVal }, { deep: true })watch(() newsFileList.value, (newVal) {if(JSON.stringify(newVal) ! JSON.stringify(props.fileList)) {$emit(success, newVal)} }, { deep: true }) /scriptstyle langscss scoped :deep(.el-upload-dragger) {padding: 56px 0;background-color: transparent;border: none; }.upload-hide {position: relative;:deep(.el-upload--picture-card) {display: none;} }.upload-container {display: flex;flex-wrap: wrap;.draggable-container {display: contents;} } /style对以上代码解释一下 重点解决el-upload上传按钮独占一行问题 .upload-container {display: flex;flex-wrap: wrap;.draggable-container {display: contents;} } 主要对limit最大限制对上传按钮隐藏  .upload-hide {position: relative;:deep(.el-upload--picture-card) {display: none;} } action主要获取OSS上传凭证这里用了代理通过前端请求后端接口会拒绝访问线上不需要代理 这段代码主要为了更新排序后的数组 watch(() newsFileList.value, (newVal) {if(JSON.stringify(newVal) ! JSON.stringify(props.fileList)) {$emit(success, newVal)} }, { deep: true }) 这里为什么选用ref并不是为了省事ref一把梭刚开始我用的 reactive但是在排序的时候一直回弹具体原因没有深究换成ref就没问题了 let newsFileList ref(props.fileList); 就解释这么多吧有什么疑问或不明白的地方可以留言有什么更好的方案请大佬们赐教写的不好请多多担待
http://www.hkea.cn/news/14288512/

相关文章:

  • 宠物网站的设计与实现外国人爱做视频网站吗
  • 网站创建人是动漫制作专业升本
  • 安徽网站设计方案线下推广方法有哪些
  • 蒙城做网站湖南企业名录大全
  • 无锡企业网站seo2017国外优秀网站设计
  • 上海 企业网站制深圳建筑工程招投标中心
  • 个人网站备案名字重要吗购物网站主页模板
  • 如何选择盐城网站开发直播网站开发好做么
  • 陕西网站推广费用网站首页的图标是怎么做的
  • 联想电脑建设网站前的市场分析网站建设需要找网站建设公司做吗
  • 想在网上做外卖 上什么网站好传奇版本网页游戏
  • 个人做外贸商城网站宝塔 wordpress ssl
  • html5网站模板免费百度排名服务
  • 二手车网站建站做微电网的公司网站
  • 商丘免费网站建设开发公司怎么做网站 新手做网站
  • 四川网站建设电话咨询深圳宝安区房价
  • 周口市住房和城乡建设局网站受欢迎的邯郸网站建设
  • 自己做网站怎么加定位大连小型网站建设
  • 澄海建设局网站上不了wordpress建立数据库连接时出错
  • 内蒙古网站seo沈阳做网站的
  • 网站开发专业成功人士国内十大网站制作公司
  • 手机分销网站建设郑州做网站msgg
  • 站长资源平台平面设计实例网站
  • 网站建设系统开发2012搭建wordpress
  • 做网站制作一般多少钱专业做网站优化
  • 网络企业网站建设方案网站不稳定有什么影响
  • 深圳网站制作三明做网站公司
  • 网站建设信息发布wordpress 批量导入
  • 我的网站现在没有排名_我想问是不是花钱做百度推广就会有排名南阳锐诚网站建设
  • 开发手机端网站怎么找做网站的