当前位置:网站首页>Second assignment notes
Second assignment notes
2022-06-23 04:40:00 【qq_ twenty million five hundred and twenty-one thousand seven h】
JS UI The framework supports custom components , Users can expand the existing components according to business requirements , Add custom private properties and events , Package into new components , It is convenient to call... Multiple times in the project , Improve the readability of page layout code .
Define a folder for storing custom components components.tabbar And set up 3 Base file tabbar.hml、tabbar.js、tabbar.css, It should be noted that :3 The file names of two files must be consistent , Otherwise, the file will not be found . The purpose of this custom component is to configure a... At the bottom of the page tabbar Tab experience .
Set the corresponding settings for the bottom tab json data source , For preservation icon picture 、 title , And click the selected icon picture .
- Import tabbarItem data , And set the corresponding data , At the same time, set the click event Click the corresponding button for dynamic setting icon Choose .
- Set up CSS style take tabbar Tab bottom 「tabbar.css」
Custom components are used by users according to business requirements , Combine existing components , Packaged into new components , You can call... Multiple times in a project , Improve the readability of the code .
Custom components are created through element Introduce to the host page , Usage method :name Property refers to the custom component name ( Not required ), Component names are case insensitive , The default is lowercase ,src Properties refer to custom components hml File path ( Required ), If not set name attribute , It is used by default hml Use the file name as the component name .
Event binding : Binding subcomponent events in custom components use (on|@)child1 grammar , Passed in the child component this.$emit('child1', { params: ' Pass parameters ' }) Trigger the event and transfer the value , Parent component execution bindParentVmMethod Method and receive the parameters passed by the subcomponent .
Props Custom components can be created by props Declarative attribute , The parent component passes parameters to the child component by setting properties ,camelCase( Hump nomenclature ) Of prop name , When an external parent component passes parameters, it needs to use kebab-case ( Short horizontal lines separate the names ) form , That is, when attribute compProp When the parent component references, it needs to be converted to comp-prop.
Add default , Subcomponents can be defined by fixed values default Set the default value , When the parent component does not set this property , Its default value will be used . In this case props Property must be in object form , It can't be in an array .
Data unidirectionality , The data transfer between parent and child components is one-way , Can only be passed from parent component to child component , The child component cannot directly modify the value passed down by the parent component , Can be props The value passed in is in data As the default value after receiving , Right again data Change the value of .
边栏推荐
猜你喜欢
![[pytoch] calculate the derivative of sin (x) by automatic differentiation](/img/a7/16dd9ecc13a986a9141ecc3fba00a1.png)
[pytoch] calculate the derivative of sin (x) by automatic differentiation

How does flutter achieve different zoom animation effects
![[deep learning] deep learning reasoning framework tensorrt MNN openvino onnxruntime](/img/a9/11bc00a91b79358f28ada2d4c99f32.png)
[deep learning] deep learning reasoning framework tensorrt MNN openvino onnxruntime

How to ensure application security

photoshop PS 查看像素坐标、像素颜色、像素HSB颜色

How node+express operates cookies

Deploying Apache pulsar on kubesphere

Redis启动有问题

【Pytorch】用自动微分求sin(x)的导数

Halcon胶线检测—模板匹配、位姿变换、胶宽,胶连续性检测
随机推荐
Common interview questions in automated testing
Lighthouse locally deployed TCA code analysis tool
解决使用Exception抛出后,@Transactional不生效
Chrome调试技巧
Can MySQL be used in Linux
C语言刷题随记 —— 自由落体的球
Redis启动有问题
Software development in 2022: five realities CIOs should know
It supports running in kubernetes, adds multiple connectors, and seatunnel version 2.1.2 is officially released!
Please use the NLTK Downloader to obtain the resource
Xiaojinwei, chairman of Chenglian Technology: implement the national strategy of data economy and lead the development of new consumption in the digital era!
[acnoi2022] no way without guessing
PTA:6-29 虚基类的应用-人与教师学生
【二叉树】翻转等价二叉树
OpenJudge NOI 1.13 51:古代密码
[deep learning] deep learning reasoning framework tensorrt MNN openvino onnxruntime
photoshop PS 查看像素坐标、像素颜色、像素HSB颜色
给你的AppImage创建桌面快捷方式
8位全加器原理
Pta:7-37 student number analysis