Notes on the use of components components in Vue projects

Table of contents

Preface

1. What is the difference between components and components?

2. Steps to use components

1. Create component vue file

2.Introduce components

 3. Register components

4. Application components

Summarize

Preface

This article is just a preliminary understanding of the steps to use recording components.


1. What is the difference between components and components?

components , which means components; component , which means components. They are different and they are used in different locations.

2. Steps to use components

1. Create component vue file

The code is as follows (example):

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
import  ssl
ssl._create_default_https_context = ssl._create_unverified_context

2.Introduce components

Introduce the component file into the vue file where the component needs to be introduced, such as introducing IndexPage.vue into App.vue

import header from '@/views/header/header'

 3. Register components

In the script section of the App.vue file, find export default and write the registration code in it

The code is as follows (example):

data = pd.read_csv(
    'https://labfile.oss.aliyuncs.com/courses/1283/adult.data.csv')
print(data.head())
export default {
  name: 'App',
  components: {
    LightView,
    IndexPage
  },
}

4. Application components

In the code part of App.vue, apply the indexPage component

<template>
  <light-view>
    <index-page></index-page>
  </light-view>
</template>

Summarize

This article is just a preliminary understanding of the steps to use recording components.

Guess you like

Origin blog.csdn.net/weixin_46442877/article/details/129254552