What is the difference between properties and data in Mini Program?

I think properties is written in the same way except for a few more parameters. What is the specific difference between the two? why should it be divided into two?


do you mean properties and data of the component?

properties is a parameter that can be passed externally when using a component, that is, the caller can modify the property externally, but not if it is placed in data .

for example, if there is a component called titleContainer , there is a title attribute in properties :

.
//...
properties: {
        title: {
            type: String,
            value: 'default title',
        }
    }
//...

use components in the page:

<titleContainer title="{{otherTitle}}"></titleContainer>

but if this title is placed in data , it cannot be modified in this way.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3f305-34823.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3f305-34823.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?