Skip to content
On this page

4 月 29 日

4 月 25 日

4 月 24 日

4 月 22 日

4 月 21 日

4 月 20 日

4 月 19 日

4 月 18 日

4 月 17 日

4 月 16 日

  • 212 vue vite public 下图片路径的问题
    javascript
        public 下面的文件路径前要加斜杠 '/'
        参考 -204下webpack打包public路径设置
    

4 月 15 日

4 月 14 日

4 月 11 日

  • 206 即偶数元素 css 给最后的元素添加样式
    javascript
        // 第二个元素,里面换成n就是第n个元素
        div:nth-child(2)
        {
        background:#ff0000;
        }
        // 选中最后一个奇数
        div:nth-child(odd):last-child {
            margin-bottom: 0;
        }
        // 选中最后一个偶数
        div:nth-child(even):last-child {
            margin-bottom: 0;
        }
        // 3的倍数元素的样式,后面的0可以换成m,就是3倍再加m
        p:nth-child(3n+0)
        {
        background:#ff0000;
        }
    

4 月 10 日

  • 205 vue style 绑定样式

    javascript
        :style="{backgroundImage: 'url(' + item.url + ')'}"
    
  • 204 vue cli public

    • 文件夹下面可以放置静态的图片资源和 json 文件
    • 注意在调用的时候不要在路径前面添加"/"
    javascript
        // 1、axios调用json数据
         this.$axios.get('data/001/family.json').then(res=>{
           console.log('this.$axios.get', res)
         })
        // 2、image路径 前面不要加斜杠了
        bannerData:[
            {imageUrl: 'images/banner/2.jpg'},
            {imageUrl: 'images/banner/1.png'},
            {imageUrl: 'images/banner/3.jpg'}
        ],
    
    

4 月 9 日

4 月 8 日

4 月 7 日

  • 196 微信小程序跳转到小程序
  • 195 vue- vnode
    javascript
    Vue.mixin({
      beforeRouteLeave: function (to, from, next) {
        console.log(this.$vnode, window);
        if (
          from &&
          from.meta.rank &&
          to.meta.rank &&
          from.meta.rank > to.meta.rank
        ) {
          console.log(this.$vnode, window, "-----------全局beforeRouteLeave");
          if (this.$vnode && this.$vnode.data.keepAlive) {
            if (
              this.$vnode.parent &&
              this.$vnode.parent.componentInstance &&
              this.$vnode.parent.componentInstance.cache
            ) {
              if (this.$vnode.componentOptions) {
                var key =
                  this.$vnode.key == null
                    ? this.$vnode.componentOptions.Ctor.cid +
                      (this.$vnode.componentOptions.tag
                        ? `::${this.$vnode.componentOptions.tag}`
                        : "")
                    : this.$vnode.key;
                var cache = this.$vnode.parent.componentInstance.cache;
                var keys = this.$vnode.parent.componentInstance.keys;
                console.log(cache, "cache-keys");
                if (cache[key]) {
                  if (keys.length) {
                    var index = keys.indexOf(key);
                    if (index > -1) {
                      keys.splice(index, 1);
                    }
                  }
                  delete cache[key];
                }
              }
            }
          }
          this.$destroy();
        }
        next();
      },
    });
    
  • 194 nginx vue 404 not found

4 月 2 日

4 月 1 日

Released under the MIT License.