Sharing tips on using vue element and nuxt

Sharing tips on using vue element and nuxt

1. Element time selection submission format conversion

For example

Fri Sep 07 2018 00:00:00 GMT+0800 (China Standard Time)
Converted to 2020-01-11 format

This record adds a sentence value-format="yyyy-MM-dd" to the datepicker

<el-date-picker type="date" v-model="createdate" @change="formatTime" value-format="yyyy-MM-dd" placeholder="Select time"></el-date-picker>

2. The problem of not being able to select the checkbox when dynamically looping

this.menulist[index].sonList.map((item)=>{
  this.$set(item, 'checked', false); ---Use Vue's set attribute to assign a value})

3.el-form dynamic form verification (v-if, v-show cause verification failure bug)

When using v-if or v-show to control the display and hiding of el-form-item, a validation failure bug will occur.

When using v-if:element to bind validation rules to subcomponents with prop attributes in the form, it is completed in the vue declaration cycle mounted. The elements used by v-if to switch will be destroyed, resulting in the form items in v-if not being rendered during the mounted period, so the rules are not

There is binding. At initialization, rules that do not meet the display conditions will not be generated, resulting in the subsequent switching of conditions, and the verification of the displayed input box will not take effect. Use v-show: All rules will be generated at initialization, and rule verification will be performed even if they are hidden.

Solution (1): Use v-if to verify. Configure a different key value after each v-if.

(2) Customized validation rules. If you like to do it yourself, you can customize the validation yourself.

4. How to add Devtools to nuxt

The following must be added to nuxt.config.js:

vue: {
 config: {
  productionTip: false,
  devtools: true
 }
}

The above is the detailed content of sharing the usage tips of vue element and nuxt. For more information about vue element and nuxt, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Some tips for using less in Vue projects
  • 22 Vue optimization tips (project practical)
  • Vue.js performance optimization N tips (worth collecting)
  • Summary of practical skills commonly used in Vue projects
  • Summary of 10 advanced tips for Vue Router
  • 8 tips for Vue that you will learn after reading it
  • Summary of common routines and techniques in Vue development
  • A brief discussion on the use of Vue functional components
  • 6 tips for writing better v-for loops in Vue.js
  • 25 Vue Tips You Must Know

<<:  Native JavaScript to implement random roll call table

>>:  Simple usage example of vue recursive component

Recommend

How to quickly use mysqlreplicate to build MySQL master-slave

Introduction The mysql-utilities toolset is a col...

How to add fields and comments to a table in sql

1. Add fields: alter table table name ADD field n...

How to install Nginx in Docker

Install Nginx on Docker Nginx is a high-performan...

Detailed tutorial on building an ETCD cluster for Docker microservices

Table of contents Features of etcd There are thre...

Detailed explanation of how Zabbix monitors the master-slave status of MySQL

After setting up the MySQL master-slave, you ofte...

Use a table to adjust the format of the form controls to make them look better

Because I want to write a web page myself, I am al...

HTML table tag tutorial (27): cell background image attribute BACKGROUND

We can set a background image for the cell, and w...

Vue mobile terminal determines the direction of finger sliding on the screen

The vue mobile terminal determines the direction ...

jQuery canvas generates a poster with a QR code

This article shares the specific code for using j...

Basic knowledge of HTML: a preliminary understanding of web pages

HTML is the abbreviation of Hypertext Markup Langu...

Mysql command line mode access operation mysql database operation

Usage Environment In cmd mode, enter mysql --vers...

Six weird and useful things about JavaScript

Table of contents 1. Deconstruction Tips 2. Digit...