uni-app (3)

Implement component modification title

uni.setNavigationBarTitle({
    
    title:'首页'})

Now there is such a problem. The teaching in the video does not seem to work very well, because the v-show of the homepage setting has this thing mounted in the component. v-show is a display, hidden, so it is loaded as soon as it comes up. , The final modification is displayed directly, so it is not suitable, and then I tried v-if again, which works, but the problem is that the v-if page is cleared, reload the page, I feel that the user experience will be bad, so in the end, I found a way to put these in the click event of the homepage, and click to change the title without reloading. Well, it’s not bad. After learning now, I can know where the bug is.
Insert picture description here

Carousel

The following points need to be noted:
swiper: The default height of 150px cannot be stretched by the content, so you need to treat it separately.
Image: the default width of 320px, the default height of 240px.
That is to say, no matter how big the screen is, it will be so high and will not change. It may be deformed,
so it is scaled proportionally (750 screen width, 2.3 aspect ratio). The
image inherits the height of the parent element. The parent element is the item, but the swiper is inherited layer by layer, so it’s okay.

<style lang='scss'>
  .album_swiper{
    
    
    swiper{
    
    
      height: calc( 750rpx / 2.3);
      image{
    
    
        height: 100%;
      }
    }
  }
</style>

Layout bug

Insert picture description here
,Because flex:1 and flex:2 are set above, this width can be changed by the content. It is indeed two copies at the beginning, but when there are many texts, the parent container will be opened. Because nowrap is set, do not wrap. So this bug is quite common. The solution is to the parent container. If the overflow is exceeded, intercept overflow: hidden, so that when it exceeds, it will be intercepted by the parent container, and it will be fine in the end.
Insert picture description here
Style is the basic skill of the front end! Nothing to say, write more.
Today, the pigeon arrived at once, and I have to write a small program to connect to OneNet to read the data, and I went to find the interface. . .

Guess you like

Origin blog.csdn.net/weixin_46013619/article/details/105008161