账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    vue数据处理问题
    39
    0
    文件上传完后可以拖拽移动,传值的时候需要在this.productForm.productPicList的数组里面添加number这个字段,代表当前图片的位置,第一位就是0,以此类推,但是拖拽后这个number的值也应该随着变动,这个应该怎么处理,感谢各位 <div class="itemContent"> <draggable v-model="productForm.productPicList" class="list-group" tag="ul" v-bind="dragOptions" @start="productForm.drag = true" @end="productForm.drag = false" > <div v-for="(item, index) in productForm.productPicList" :key="index" v-loading="productForm.loadingapp" class="listitem" @mouseenter="showDelBtn(index)" @mouseleave="hiddenDelBtn" > <img v-if="item" :src="item.attachment" width="148" height="148" class="imgSty" /> <i class="el-icon-delete delIcon" @click="deleImg(item, index)" /> </div> </draggable> <div class="uploadIcon"> <el-upload :show-file-list="false" action="" list-type="picture-card" :on-success="handlePictureSuccess" :on-change="onBeforeUpload" :auto-upload="false" > <i class="el-icon-plus" /> </el-upload> </div> </div> onBeforeUpload(file) { console.log(file, 'file-----------'); let reader = new FileReader() reader.onload = e => { this.num++; let base64 = e.target.result //从本地读取的图片的base64格式,将它上传给服务器即可 this.productForm.productPicList.push({ attachment: base64,number:this.num,id: '', file }); console.log(this.productForm.productPicList, 'filelist222222') this.copyFileList = JSON.parse( JSON.stringify(this.fileList).replace(/attachment/g, 'url') ) } // console.log( this.formIdentify.ohtherCredentials ) reader.readAsDataURL(file.raw) return false },
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 半离 普通会员 1楼

      在Vue中,数据处理主要涉及到两个方面:一是Vue的模板渲染,二是数据的绑定和计算。

      1. Vue的模板渲染:这是Vue通过JavaScript引擎解析HTML代码,然后将解析后的HTML返回给用户的方式。在Vue的模板中,我们可以通过v-for指令来遍历数据并进行渲染。例如,如果我们有一个数据数组,我们可以这样使用v-for指令来渲染:

      ```html

      ```

      在这个例子中,我们使用v-for指令来遍历数组中的每个元素,并使用key属性为每个元素指定唯一的标识。

      1. 数据绑定和计算:这是Vue通过监听数据变化并自动更新视图的方式。在Vue中,我们可以通过data属性来存储数据,并通过计算属性来实现数据的计算和绑定。例如,如果我们有一个数据数组,我们可以这样使用data属性和计算属性来实现数据的计算:

      ```html

      ```

      在这个例子中,我们使用data属性来存储数据,并使用计算属性来实现数据的计算。计算属性计算数组中所有元素的总和,然后返回这个总和。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部