Mini Program dynamically displays shadow hide child components according to the value of the parent component.

Sub-components:
< view class="dialog" hidden=" {{show}}">
< view > {{title}} < / view >
< view > {{content}} < / view >
< view class="btn" >

<text bindtap="confirmEvent"></text>
<text bindtap="cancelEvent"></text>

< / view >
< / view >
Sub-component js:
properties: {

title:{
  value:"",
  type: String,
},
content: {
  value: "",
  type: String,
},
show:{
  type:Boolean,
  value:false
}

},
/ *

  • initial data of the component

* /
data: {
},
ready:function () {

console.log("ready")

},
parent component:
< compontent_child id= "child" data-show= "{{show}}" title= "11111111" content= "2222222222" bindcancelEvent= "_ cancelEvent"

  bindconfirmEvent="_confirmEvent"></compontent_child>

< button bindtap="showDialog" > Click on the pop-up window < / button >
parent component js:
/ / pages/parent/parent.js
Page ({

)

/ *

  • initial data of the page

* /
data: {

show:true

},

showDialog:function (e) {

this.setData({
  show:!this.data.show,
})
console.log(this.data.show)

}
})

at present, according to the showDialog event of the parent component, you want to control the show, to use data-show to pass to the child component, and the child component receives the value of show, thus controlling the display and hiding

.
Jul.30,2021
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-1b384c4-2c0e3.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-1b384c4-2c0e3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?