uni-app注意点

hykeda4年前uniapp288

vue只会将已经在data中声明的属性变为响应,没有声明的是不响应的,特别是数组和对象千万要注意

export default({

    data(){

      return{

        abc:'',

        list:{a:'a',b:'b'},

      }

    },

    methods: {

          abcclick() {

          //  可以触发渲染

           this.abc='c'

          },

          click() {

          //  未声明不触发渲染,原先对象中没有c

           this.list.c='c'

          },

          hadelClick(){

            // 解决方法,使用vue提供的$set方法来触发渲染

            this.$set(this.list,'d','d')

          }

        }

  })



uni-app官方提供的popup插件,底部弹出会因为在iphoneX的底部有安全距离,出现底部留空现象。如不需要可以注释掉插件中的css:

/* iphonex 等安全区设置,底部安全区适配 */

/* #ifndef APP-NVUE */

    padding-bottom: constant(safe-area-inset-bottom);

    padding-bottom: env(safe-area-inset-bottom);

    /* #endif */

image.png

相关文章

uniapp微信小程序保存base64图片的方法

使用uni.getFileSystemManager().writeFile去下载base64图片<view class="share-btn" @click="s...

uniapp开发微信小程序中使用block标签,在开发环境显示正常,生产环境中显示错误问题

在使用uniapp开发微信小程序时,使用了block标签进行了逻辑判断:<block v-show="list.type === 2">...

微信小程序 getUserProfile直接进入fail函数,getUserProfile调用失败:fail can only be invoked by user TAP gesture.

问题描述小程序更改了调用用户信息的接口调用getUserProfile直接进入失败返回的错误信息如下getUserProfile:fail can only be invoked by user TA...

uni-app错误总结

H5页面中报错信息:[Vue warn]: Duplicate keys detected: 'pages/index/index'. This may cause an update...

关于uniapp中v-for循环使用slice(0, 4)导致click事件报错问题

关于uniapp中v-for循环使用slice(0, 4)导致click事件报错问题

在使用uniapp开发时遇到只要循环数组的前四个值,使用了slice函数,在添加click事件后报错:_vm.e0 is not a function<view   ...

HBuilderX打开微信开发工具失败解决方案

先停止运行到微信开发工具, 然后在微信开发者工具设置-安全里面那个服务端口, 关闭再打开。重新运行就可以了 !...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。