vue項(xiàng)目無法刪除的問題及解決
vue項(xiàng)目無法刪除
問題
今天刪除本地的vue項(xiàng)目,一直提示“操作無法完成,因?yàn)槠渲械奈募A或文件已在另一個(gè)程序組打開,請(qǐng)關(guān)閉該文件夾或文件,然后重試”。
但是相關(guān)的軟件我都關(guān)閉了,還是不行。如圖
解決
我們ctrl+alt+delete打開任務(wù)管理器,點(diǎn)擊詳細(xì)信息,找到node.exe
右擊選擇結(jié)束任務(wù),然后點(diǎn)擊結(jié)束進(jìn)程,然后就可以成功刪除項(xiàng)目了。
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="點(diǎn)擊添加" @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.通過對(duì)數(shù)組的操作,進(jìn)行添加和刪除;
2.這里應(yīng)注意index這個(gè)索引,用于刪除時(shí),知道刪的是哪一個(gè)值;
3.刪完對(duì)應(yīng)的值,要對(duì)數(shù)組的index這個(gè)索引重組,否則再刪除時(shí)會(huì)出錯(cuò);
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
vue實(shí)現(xiàn)點(diǎn)擊展開點(diǎn)擊收起效果
這篇文章主要介紹了vue實(shí)現(xiàn)點(diǎn)擊展開,點(diǎn)擊收起效果,首先我們需要定義data里面的數(shù)據(jù),使用computed對(duì)data進(jìn)行處理,需要的朋友可以參考下2018-04-04vue如何把字符串中的所有@內(nèi)容,替換成帶標(biāo)簽的
這篇文章主要介紹了vue如何把字符串中的所有@內(nèi)容,替換成帶標(biāo)簽的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-10-10vue?this.$router.go(-1);返回時(shí)如何帶參數(shù)
這篇文章主要介紹了vue?this.$router.go(-1);返回時(shí)如何帶參數(shù)問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-12-12vue+elementUI-el-table實(shí)現(xiàn)動(dòng)態(tài)顯示隱藏列方式
這篇文章主要介紹了vue+elementUI-el-table實(shí)現(xiàn)動(dòng)態(tài)顯示隱藏列方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-01-01vue自定義鍵盤實(shí)現(xiàn)車牌號(hào)的示例代碼
本文主要介紹了vue自定義鍵盤實(shí)現(xiàn)車牌號(hào)的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-07-07axios取消請(qǐng)求與避免重復(fù)請(qǐng)求
在項(xiàng)目中經(jīng)常有一些場(chǎng)景會(huì)連續(xù)發(fā)送多個(gè)請(qǐng)求,而異步會(huì)導(dǎo)致最后得到的結(jié)果不是我們想要的,并且對(duì)性能也有非常大的影響,這篇文章主要給大家介紹了關(guān)于axios取消請(qǐng)求與避免重復(fù)請(qǐng)求的相關(guān)資料,需要的朋友可以參考下2021-06-06