uni-app entry

First, what is uni-app

uni-app is a development framework Vue.js use all front-end application developers to write one set of code, you can publish to iOS, Android, H5, and a variety of small programs (micro-channel / Alipay / Baidu / headlines / QQ / nails ) and other platforms

Second, the installation

uni-app support through the visual interface to quickly create project vue-cli command line in two ways.

By visual interface HBuilderX
Here Insert Picture Description
vue-cli command line

vue create -p dcloudio/uni-preset-vue my-project

Select a template (first experience can choose hello uni-app project template)
Here Insert Picture Description
creation. . . Here Insert Picture Description
Once created the prompts to enter the project to be all
Here Insert Picture Description
Here Insert Picture Description
files in the directory :( different templates, file directory is different ...)
Here Insert Picture Description

Third, configure and use

1, the browser and run the configuration applet

→ → run setting means setting
Here Insert Picture Description
2, the micro-channels run Developer Tools

Micro-channel will automatically open Developer Tools After compiling the
Here Insert Picture Description
** ** here in bold style insert a picture description
3 file directory
Here Insert Picture Description
4, a new page

New page in the pages, you can select different template
Here Insert Picture Description
Once created, it will automatically automatically configured page.json in (such benefit is that we do not have a build a configuration, save a lot of thing, Nice ~)
Here Insert Picture Description
5, SCSS

Tools → plug-in installation, the configuration and scss related plug-in download it again
Here Insert Picture Description
when we write a page can be directly used only scss friends
Here Insert Picture Description

Fourth, change the label of HTML and uni-app

Html tag used to be, now is the applet tag

div 改成 view
span、font 改成 text
a 改成 navigator
img 改成 image
input 还在,但type属性改成了confirmtype
form、button、checkbox、radio、label、textarea、canvas、video 这些还在。
select 改成 picker
iframe 改成 web-view
ul、li没有了,都用view替代
audio 不再推荐使用,改成api方式,背景音频api文档
其实老的HTML标签也可以在uni-app里使用,uni-app编译器会在编译时把老标签转为新标签。
但不推荐这种用法,调试H5端时容易混乱,基于元素的选择器也会出问题。

End mobile phones used new components

scroll-view 可区域滚动视图容器
swiper 可滑动区域视图容器
icon 图标
rich-text 富文本(不可执行js,但可渲染各种文字格式和图片)
progress 进度条
slider 滑块指示器
switch 开关选择器
camera 相机
live-player 直播
map 地图
cover-view 可覆盖原生组件的视图容器
cover-view需要多强调几句,uni-app的非h5端的video、map、canvas、textarea是原生组件,层级高于其他组件。
如需覆盖原生组件,比如在map上加个遮罩,则需要使用cover-view组件

Reprinted from ( Portal )

V. Unit Description

rpx responsive i.e. px, it is a dynamic adaptation unit according to the screen width. Uni-app predetermined reference width of the screen is 750rpx

所以,在实际开发中,1 rpx = 750 * ( 设计稿宽度 / 设计稿基准宽度 )

Find the manifest.json file in our project, an illustration

Open px turn rpx (off by default) in the settings file mainfest.json, all of the px can be converted to a key rpx
Here Insert Picture Description
Note:

(1) rpx is related to the width of the unit, the more wide-screen elements will be greater, if not with the width of the screen zoom, use px.

(2) or the height of the font used rpx, it should be noted that this wording means that as the screen becomes wider, the font becomes large, the height increases.

(3) rpx not support cross-screen switching, if rpx recommended to lock the screen orientation.

(4) early uni-app recommended upx, the current official recommendation has been unified into a rpx.

Published 15 original articles · won praise 38 · views 3555

Guess you like

Origin blog.csdn.net/qq_45784580/article/details/104638126