How does Vue Xiaokai Bookkeeping (1.03) convey the information of repeated tags?

How does Vue Xiaokai Bookkeeping (1.03) convey the information of repeated tags?

I wrote a model about modifying TagList and added a create method to the model.

Prepare to use the error reporting style first. If the created label has been repeated before, an error will be reported.

Note: The above flag determination method uses: Array.prototype.some(function)

The some method passes a function inside. This function traverses all elements in the array. If there is an element that satisfies the following formula, it returns true, otherwise it returns false.

The sixth act I wrote determines whether the name of the passed tag is the same as the name of the element in the database.

So write an ok() method in another part of otherTag in order to add a new tag into the display area.


But it is very inconvenient for the front end to throw errors.

Originally I wanted to return the numbers 0, 1, 2, 3 instead of repeat, failure, and success (similar to the status code), but it was very troublesome to write comments one by one.

The best consideration is to directly return the string with information, and perform judgment operations by comparing the strings.