E
E
Edward2018-06-08 10:40:01
Yii
Edward, 2018-06-08 10:40:01

How to pass validation rules from yii2 to vue.js?

There was an idea to start using vue.js at the front, so it became interesting to know how, for example, to transfer validation rules from yii2?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-06-08
@webinar

Vue does not exclude jquery and does not exclude standard validation. The main beauty of vue.js is that you can implement it in places, gradually, without breaking the existing architecture.
But getting rid of jquery is a sound idea, and the developers themselves announced it in the next major versions. I also planned to do this if possible, but so far I do not see a beautiful way to do it. The most probably viable is to create validators for vue, counterparts of regular ones and a behavior that will iterate over the rules and, depending on the scenario, rebuild the rules with the replacement of the standard validators. It looks like a crutch of course, but it should work. Here are just a lot of work there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question