<template>
<transition-group tag="ul">
<li v-for="item in items" v-bind:key="item" @click="del(item)">{{item}}</li>
</transition-group>
</template>
<script>
export default {
data() {
return {
items: []
}
},
methods: {
del(item) {
this.$confirm('删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.items.splice(this.items.indexOf(item), 1)
this.$message({
type: 'success',
message: '删除成功!'
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
</script>