In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how vue implements the small function of form validation. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The details are as follows
1. Route hopping
First click on the src directory configuration router file in the Vue project, then expose your form page name with import and register the routing table code in your Router instance as follows
Import Create from "@ / views/create/create.vue"; / / is preceded by the exposed name, with the first letter capitalized. At the back is the directory where your form page is located @ is.. The abbreviation for const router=new Router is to return the upper layer const router=new Router ({mode: "history" / / here is to write what the route pattern is routes: [{path: "/ create", / / default / multiple is / plus the path name: "create", component: Create, title: "form",},]})
Remember to configure the to option of your own router-link tag in the home page after the routing table has been configured
Form
Then comes the form page.
Effect picture
The function implementation code is as follows
The plug-in uses element.ui that can be viewed in package.json and referenced in main.js after a successful installation using npm I element-ui in the terminal
After the installation is complete, it can be used.
Welcome to release the new recipe, first introduce your masterpiece! Title, attribute, recipe, classification, finished product map (328,440) Record all raw materials, main materials and auxiliary materials to start writing steps! Whether it is easy to learn depends on how you write. Come on! Add a cooking tip: submit import Stuff from ". / stuff"; import Upload from ". / step-upload"; import UploadImg from "@ / components/upload-img"; import {getProperty, getClassify, publish} from "@ / service/api"; const raw_materia_struct = {name: ", specs:",} Export default {name: "create", components: {Stuff, Upload, UploadImg}, data () {return {backData: {title: ", property: {}, classify:", product_pic_url: ", product_story:" Raw_material: {raw_material: Array (3) .fill (1) .map (() = > ({... raw_materia_struct})), accessories_material: Array (3) .fill (1) .map (() = > ({... raw_materia_struct})),},}, propertyies: [] Classifies: [],} }, mounted () {getProperty (). Then (({data}) = > {console.log (data); this.propertyies = data; this.backData.property = data.reduce ((o, item) = > {o [item.title] = "; return o;}, {}); / / console.log (data); / / console.log (this.backData.property)}) GetClassify () .then (({data}) = > {console.log (data); this.classifies = data;});}, methods: {add () {console.log (1);},}; .create-introduce background-color # fff padding 20px .add-step-button margin-left 100px .create width 100h3 text-align center margin 20px 0.send / / ff3232 () height: 70px Width: 220px; background # ff3232 color # fff border none margin 20px auto display block h6 margin 20px 0. Create-input input width 446px line-height 22px.upload-img-box. Upload-img float left. Introduce-text float left. El-textarea width 60% margin-left 10px thank you for reading! This is the end of this article on "how to achieve the small function of form verification in vue". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.