The vue component consists of several parts

青灯夜游
Release: 2022-12-20 15:08:05
Original
4485 people have browsed it

The vue component consists of 3 parts: 1. template, which sets the template structure of the component; 2. script, which sets the JavaScript behavior of the component; 3. style, which sets the style of the component. Each component must contain a template template structure, and script behavior and style are optional components; "

The vue component consists of several parts

# #The operating environment of this tutorial: Windows 7 system, vue3 version, DELL G3 computer.

vue is a framework that fully supports component development. The suffix name of the component specified in vue is .vue. I have come into contact with it before The App.vue file is essentially a vue component. Each .vue component is composed of 3 parts, namely:

  • ##template -> Component Template structure

  • script -> Component’s JavaScript behavior

  • ##style -> ; Component style
  • Among them, each component must contain a template template structure, while script behavior and style are optional components. Vue stipulates: The template structure corresponding to each component needs to be defined in the

<template>
<!-- 当前组件的DOM结构,需要定义到template 标签的内部
</ template>
Copy after login
Note: