|
@@ -6,7 +6,7 @@
|
|
|
@click="checkItem(item,index)"
|
|
|
ref="span"
|
|
|
:class="{
|
|
|
- 'saga-warning': (closedStr.indexOf(index) > -1)
|
|
|
+ 'saga-warning': isWarning(item)
|
|
|
} "
|
|
|
class="cut-string saga-border pointer border-hover"
|
|
|
>{{item}}</span>
|
|
@@ -35,6 +35,14 @@
|
|
|
created() {},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
+ //是否在危险状态
|
|
|
+ isWarning(val){
|
|
|
+ if(this.closedStr.indexOf(val) > -1){
|
|
|
+ return true
|
|
|
+ }else{
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ },
|
|
|
checkItem(item, index) {
|
|
|
if(this.obj.hasOwnProperty(index)){
|
|
|
delete this.obj[index]
|
|
@@ -49,17 +57,28 @@
|
|
|
this.$refs.span[index].setAttribute('class',classList)
|
|
|
}
|
|
|
},
|
|
|
- clear() {
|
|
|
+ clear(str) {
|
|
|
this.obj = {}
|
|
|
this.stringArr = this.string.split("")
|
|
|
for(let i = 0; i < this.stringArr.length; i++){
|
|
|
let classList = this.$refs.span[i].getAttribute('class')
|
|
|
- console.log(classList,'classList')
|
|
|
if(classList.indexOf('bg') > -1){
|
|
|
classList = classList.split('bg')
|
|
|
}
|
|
|
this.$refs.span[i].setAttribute('class',classList)
|
|
|
}
|
|
|
+ if(!!str){
|
|
|
+ let strsArr = str.split("")
|
|
|
+ strsArr.map((item,index) => {
|
|
|
+ for(let j = 0; j < stringArr.length;j++){
|
|
|
+ if(item == stringArr[j]){
|
|
|
+ this.obj[j] = item
|
|
|
+ let classList = this.$refs.span[j].getAttribute('class') + ' bg'
|
|
|
+ this.$refs.span[j].setAttribute('class',classList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
getData() {
|
|
|
let string = ""
|