Vue visualization large screen tutorial

 

In our daily life, we often see various large screens, some of which are traditional data large screens, such as industrial monitoring large screens, environmental protection monitoring large screens, etc. The main function of these large screens is to display information, allowing users to quickly obtain information and avoiding visual fatigue when users read. Another part is a large intelligent visual data screen, such as smart home, smart city, smart park, etc. But with the improvement of our living standards, our requirements for information are getting higher and higher. If we want to know more information, we have to look at the big screen. If you want to know the development of a certain industry or region, you need to look at their real-time data; if you want to know the economic development of a certain region of the country, you need to look at their economic index data; For the development situation, you need to look at their GDP data and so on. At this time, the traditional large data screen cannot meet the user's demand for information. Vue is a component-based front-end framework that supports a variety of components and is easy to maintain and expand.

  • 1. Preparation

    First of all, we need to prepare a large screen, which can be a webpage, a picture or other types, in short, it must meet the content we need to display. Then, we need to install Vue. The installation of Vue is relatively simple and will not affect the use. Before we start, let's take a look at the installation process of Vue. Search for "vue3" in the "Component Library", and then choose to install it. In the Vue project, we can create new components or update components by editing components, and configure the properties and events of components through the component library. After creating a new component through the component library, we can use this component to achieve what we want to display. For example, the content in the big data screen can be displayed in the form of a list or a table. In addition, we can also achieve different visualization effects by setting different effects. For example, setting dynamic graphs, animations, etc. The above are the operation methods of the Vue visualized large screen, and then we will start to make it!

  • 2. Basic configuration

    The configuration of Vue is relatively simple. You only need to copy the configuration file to your own project. Generally, the configuration files are in the root directory of the project, and you can also create a virtual folder in the root directory of Vue. Then just add this virtual folder to the vue component. If you want to export the configuration file, you need to add the configuration file to the vue component. The specific steps are as follows: 1. First create a new component in vue . 2. Open the Vue project manager in the browser, and then click the "+" sign on the upper right to enter the vue component manager. 3. Click the "New Component" button on the left menu bar. 4. Then click the "Import" button in the left menu bar, and then click the "Browse" button in the pop-up interface. 5. Then select the folder to be exported in the pop-up window and copy it to the new component. 6. Finally, double-click the newly created component file to view the configuration file just generated. 7. In this way, the basic configuration is completed, and we can then visualize the data on the big screen.

  • 3. Visual components

    Visual Components is an object-oriented programming technique that uses HTML, CSS, and JavaScript to achieve visual effects. Visual components are highly versatile and can also be used in Vue. For example, the online data large screen built with Vue is a typical visual component. Visual components can be used to quickly build a large data screen. For example, you can use the styles in Vue to design a rendering of a large data screen. This method is fast and does not affect the overall effect. Visualization components can be used not only for large online data screens, but also for various electronic reports and online documents in enterprises. For example, Excel is often used in enterprises to make various data reports. If Excel is visualized with Vue, various exquisite data reports can be directly edited online. For example, the following Excel chart is made using Vue:

  • 4. Data import

    In Vue, the data import function is realized by using the selector method in the component. Its function is to bind the imported data with the data in the component, so that it is convenient to control the control of the component. When using the selector method, you need to set it first: (1) Set the data type to values ​​(parameter): (2) Set whether the data needs to be filtered: (3) Set whether there are conditions and control columns: The specific operations are as follows: First, in In the button attribute of the component, add a parameter: selector_sample, and set its value as the custom value of the component. Then add the selector method of the component to the component. This makes it possible to use that data in the component.

  • 5. Data display

    1. Map display is a common way of data display. It can intuitively show the distribution of a region, and it is convenient for users to understand the development of a certain region. We can use map display for data analysis, and then apply it to the large visual screen. 2. Line chart: A line chart is a common chart, which can visually show the change of data at a certain point in time, and can be used to show the trend of a certain data.

  • 6. User Management

    We can manage users through the user management function, and at the same time, we can set the permissions of different users. User management functions include login and registration. The login function is provided to the user login page, and the registration function is provided to the user registration page. On the login page, we can set different roles, and different roles have different permissions. Roles include administrators and ordinary users. Administrator rights are to create, edit, delete, delete passwords, etc.; ordinary user rights are to browse, download, export, etc. In addition, the administrator can also set different operation methods, such as double-clicking or entering numbers in the input box. We can also set different passwords, and the page can only be accessed after entering the correct password. On the registration page, we can set different verification codes, which are divided into ordinary verification codes and advanced verification codes. Ordinary verification codes can only be used after entering the password in the input box; advanced verification codes can only be used after entering the password in the input box. In addition to the above functions, we can also set different login interfaces.

  • 7. Code output

    We have learned how to build a demo with Vue before, and now we can start writing code. In the above code, we define the component as: demo.v-patch, we can also add a <script> tag to set the format of the component, which is used in js, v-patch.bash can Drag components onto the page when needed. Now we can drag components onto the page to draw. Let's take a look at the rendering first: Now we can write code. When we open the Vue file, we will find that we are now in an empty list. When we click on the component, the list will be loaded. When we click on the first component, the components in the page will appear on the upper left of the screen;

The following is a simple Vue visual big screen code example:
```
<template>
<div class="dashboard">
<div class="chart-container">
<echarts :options="chartOptions" class="chart"> </echarts>
</div>
</div>
</template>
<script>
import echarts from 'echarts'
export default { name: 'Dashboard',components: { echarts},data() { return { chartOptions: { title : { text: 'A site user's access source',subtext: 'Purely fictitious',left: 'center'},tooltip: { trigger: ' formatter: '{a} <br/>{b} : {c} ({d}%)' }, legend: {

















orient: 'vertical',
left: 'left',
data: ['direct access', 'email marketing', 'affiliate advertising', 'video advertising', 'search engine'] }
,
series: [
{ name: 'access Source', type: 'pie', radius: '55%', center: ['50%', '60%'], data: [ { value: 335, name: 'direct access' }, { value: 310 , name: 'Email Marketing' }, { value: 234, name: 'Affiliate Advertising' }, { value: 135, name: 'Video Advertising' }, { value: 1548, name: 'Search Engine' } ], itemStyle : { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } ] } } } } </script>

























<style scoped>
.dashboard { height: 100vh; display: flex; justify-content: center; align-items: center; } .chart-container { width: 80%; height : 80 % ; %; } </style> ``` This example uses the ECharts library to draw a simple pie chart and display it in a Vue component. You can modify the data and styles according to your own needs to create your own large visual screen.














Guess you like

Origin blog.csdn.net/qq_42751978/article/details/130991364