Detailed explanation of the difference between uniapp and vue

Detailed explanation of the difference between uniapp and vue

Project Directory:

┌─uniCloud cloud space directory, Alibaba Cloud is uniCloud-aliyun, Tencent Cloud is uniCloud-tcb
│─components The uni-app component directory that complies with the vue component specification│ └─comp-a.vue The reusable a component ├─The directory where the hybrid App stores local HTML files ├─platforms The directory where the dedicated pages of each platform are stored ├─pages The directory where the business page files are stored│ ├─index
│ │ └─index.vue index page│ └─list
│ └─list.vue list page ├─static The directory for storing local static resources (such as pictures, videos, etc.) referenced by the application. Note: static resources can only be stored here ├─uni_modules Stores uni_module standard plug-ins.
├─wxcomponents is the directory for storing applet components ├─main.js Vue initialization entry file ├─App.vue application configuration, used to configure the global style of the App and monitor the application life cycle ├─manifest.json configures the application name, appid, logo, version and other packaging information └─pages.json configures page routing, navigation bar, tabs and other page class information

1. Simple page example

<template> <view class="hello">{{hello}}view>template><script>export default { data() {return {hello: 'hello, 我是神的尾巴' } } }script><style>.hello {color: red;}style>

2.uni-app supports mixed use of vue components and mini-program native components

For specific usage, see uni-app Mini-Program Component Support: https://uniapp.dcloud.io/frame?id=Mini-Program Component Support.

3. Common tags and components include view, text, swiper, scroll-view, etc.

Supports nesting and

and are not a component, they are just a wrapper element that does not render anything on the page and only accepts control properties.

<template>
    <view>
        <template v-if="test">
            <view>Displayed when test is true</view>
        </template>
        <template v-else>
            <view>Displayed when test is false</view>
        </template>
    </view>
</template>

4. Life Cycle

4.1 Application life cycle, in app.vue

insert image description here

4.2 Page life cycle, can be written in each page.

uni-app supports the following page lifecycle functions:

insert image description here

onLoad: function() {
console.log('visitor onLoad');
},
onShow: function() {
console.log('visitor onShow');
},
mounted: function() {
console.log('visitor mounted');
},

4.3 Component life cycle, equivalent to the life cycle of Vue.

insert image description here

5. Use plugins

uni-app plug-in market, to find some plug-ins suitable for our business scenarios.

For example, the pull-down refresh plug-in, the native APP one-click login plug-in, etc.

Summarize

This article ends here. I hope it can be helpful to you. I also hope that you can pay more attention to more content on 123WORDPRESS.COM!

You may also be interested in:
  • uniapp dynamic modification of element node style detailed explanation
  • Detailed explanation of uniapp painless token refresh method
  • Detailed explanation of uniapp's global variable implementation
  • Detailed explanation of styles in uni-app

<<:  HTML table tag tutorial (24): horizontal alignment attribute of the row ALIGN

>>:  About Docker security Docker-TLS encrypted communication issues

Recommend

Detailed explanation of the process of docker packaging Python environment

The steps of docker packaging Python environment ...

Native js to achieve seamless carousel effect

Native js realizes the carousel effect (seamless ...

Baota Linux panel command list

Table of contents Install Pagoda Management Pagod...

Display flex arrangement in CSS (layout tool)

Regarding display: flex layout, some people have ...

A brief discussion on four solutions for Vue single page SEO

Table of contents 1.Nuxt server-side rendering ap...

Learn asynchronous programming in nodejs in one article

Table of Contents Introduction Synchronous Asynch...

Vue batch update dom implementation steps

Table of contents Scene Introduction Deep respons...

JavaScript implements cool mouse tailing effects

After watching this, I guarantee that you have ha...

Tutorial on installing MYSQL8.X on Centos

MySQL installation (4, 5, 6 can be omitted) State...

Tutorial on deploying the open source project Tcloud with Docker on CentOS8

1. Install Docker 1. I installed Centos7 in the v...

Float and Clear Float in Overview Page

1. Float: The main purpose is to achieve the effe...

MySQL 8.0.15 installation graphic tutorial and database basics

MySQL software installation and database basics a...

How to play local media (video and audio) files using HTML and JavaScript

First of all, for security reasons, JavaScript ca...

Detailed explanation of Linux text editor Vim

Vim is a powerful full-screen text editor and the...