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)文章
使用electron-builder將項(xiàng)目打包成桌面程序的詳細(xì)教程
這篇文章主要介紹了使用electron-builder把web端的項(xiàng)目打包生成桌面程序,并可安裝程序,文中通過代碼示例和圖文結(jié)合的方式給大家介紹的非常詳細(xì),具有一定的參考價(jià)值,需要的朋友可以參考下2024-08-08
Vue+axios使用FormData方式向后端發(fā)送數(shù)據(jù)
在前后端分離的項(xiàng)目中經(jīng)常使用到Vue+axios通過FormData的方式向后端發(fā)送表單數(shù)據(jù),下面就來介紹一下如何實(shí)現(xiàn),感興趣的可以了解一下2023-09-09
vue 使用自定義指令實(shí)現(xiàn)表單校驗(yàn)的方法
今天小編就為大家分享一篇vue 使用自定義指令實(shí)現(xiàn)表單校驗(yàn)的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-08-08
一文詳解vue各種權(quán)限控制與管理實(shí)現(xiàn)思路
這篇文章主要為大家介紹了vue各種權(quán)限控制與管理的實(shí)現(xiàn)思路詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-03-03
vue-mounted中如何處理data數(shù)據(jù)
這篇文章主要介紹了vue-mounted中如何處理data數(shù)據(jù)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-03-03

