vue項目無法刪除的問題及解決
vue項目無法刪除
問題
今天刪除本地的vue項目,一直提示“操作無法完成,因為其中的文件夾或文件已在另一個程序組打開,請關(guān)閉該文件夾或文件,然后重試”。
但是相關(guān)的軟件我都關(guān)閉了,還是不行。如圖

解決
我們ctrl+alt+delete打開任務(wù)管理器,點擊詳細信息,找到node.exe

右擊選擇結(jié)束任務(wù),然后點擊結(jié)束進程,然后就可以成功刪除項目了。

vue新增與刪除問題
<template>
? <div>
? ? <ul v-for="(item , index) in list" :key="index">
? ? ? <li>
? ? ? ? {{item.serial}}---
? ? ? ? <button @click="remove(index)">刪除</button>
? ? ? </li>
? ? </ul>
? ? <input type="text" v-model="serial" />
? ? <input type="button" value="點擊添加" @click="getserial" />
? </div>
</template><script>
export default {
? data() {
? ? return {
? ? ? list: [
? ? ? ? { serial: 1 },
? ? ? ? { serial: 2 },
? ? ? ? { serial: 3 },
? ? ? ? { serial: 4 },
? ? ? ? { serial: 5 }
? ? ? ],
? ? ? serial: ""
? ? };
? },
? methods: {
? ? getserial() {
? ? ? this.list.push({
? ? ? ? serial: this.serial
? ? ? });
? ? ? this.serial = "";
? ? },
? ? //通過索引刪除數(shù)組
? ? remove(index) {
? ? ? //splice 操作數(shù)組的方法
? ? ? this.list.splice(index, 1);
? ? }
? }
};
</script>
?
<style>
</style>html:
<template> ? <el-main> ? ? <el-col :span="24" class="warp-main" v-loading=""> ? ? ? <el-form :inline="true" class="demo-form-inline" v-for="(item, i) in FormArr" :key="i"> ? ? ? ? <el-form-item label="樣例"> ? ? ? ? ? <el-input v-model="item.value"></el-input> ? ? ? ? </el-form-item> ? ? ? ? <el-button type="primary" @click="Delete(item.index)">刪除</el-button> ? ? ? </el-form> ? ? ? <el-button type="primary" @click="AddForm">增加更多</el-button> ? ? </el-col> ? </el-main> </template>
邏輯:
<script>
export default {
? data () {
? ? return {
? ? ? FormArr: [
? ? ? ? {
? ? ? ? ? index: 0,
? ? ? ? ? value: ''
? ? ? ? }
? ? ? ]
? ? }
? },
? methods: {
? ? AddForm () {
? ? ? this.FormArr.push({
? ? ? ? index: this.FormArr.length,
? ? ? ? value: ''
? ? ? })
? ? ? console.log(this.FormArr)
? ? },
? ? Delete (index) {
? ? ? this.FormArr.splice(index, 1)
? ? ? for (let i in this.FormArr) {
? ? ? ? this.FormArr[i].index = i
? ? ? }
? ? }
? }
}
</script>注釋:
1.通過對數(shù)組的操作,進行添加和刪除;
2.這里應(yīng)注意index這個索引,用于刪除時,知道刪的是哪一個值;
3.刪完對應(yīng)的值,要對數(shù)組的index這個索引重組,否則再刪除時會出錯;
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
使用electron-builder將項目打包成桌面程序的詳細教程
這篇文章主要介紹了使用electron-builder把web端的項目打包生成桌面程序,并可安裝程序,文中通過代碼示例和圖文結(jié)合的方式給大家介紹的非常詳細,具有一定的參考價值,需要的朋友可以參考下2024-08-08
Vue+axios使用FormData方式向后端發(fā)送數(shù)據(jù)
在前后端分離的項目中經(jīng)常使用到Vue+axios通過FormData的方式向后端發(fā)送表單數(shù)據(jù),下面就來介紹一下如何實現(xiàn),感興趣的可以了解一下2023-09-09
一文詳解vue各種權(quán)限控制與管理實現(xiàn)思路
這篇文章主要為大家介紹了vue各種權(quán)限控制與管理的實現(xiàn)思路詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-03-03
vue-mounted中如何處理data數(shù)據(jù)
這篇文章主要介紹了vue-mounted中如何處理data數(shù)據(jù)方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-03-03

