分类 uni-app 下的文章
1.uview小程序必须在onReady下加上一行设置规则的方法onReady() {
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
this.$refs.uForm.setRules(this.rules)
},
2.动态使用,v-for需要放在u-form下的view下面3.u-form-item中的表单必须改为 :prop="tableData.${index}.requestQty"4.在data中先配置校验规则rules和循环列表同名的tableData数组,然后增加动态增加的规则or- 阅读剩余部分 -
最近使用uniapp开发,想做个发邮件的功能,感觉有点繁琐,所以就用自动复制邮箱到粘贴板,实现方式如下uni.setClipboardData({
data: '406320591@qq.com',
success: () => {
console.log('success');
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
uniapp 原生自带,偷懒搬个demo 传送门<template>
<view class="page-body">
<page-head title="movable-view,可拖动视图"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-title uni-commo- 阅读剩余部分 -
实现原理是基于uniapp的uni.$on、uni.$emit uni.$off监听实现的。首先在当前页面增加onUnload生命周期函数 onUnload() {
uni.$emit('refresh');
},
然后在上一级组件里面增加onLoad(opts){
console.log('opts',opts)
uni.$on('refresh',() => {
this.getWorkOrderUnShelveMaterialList()
})
},
onUnload(){
console.log('onUnload')
- 阅读剩余部分 -
在Page_A页面跳转到 Page_B页面传参时,如下uni.navigateTo({
url: `/pages/KanbanMaterialRemoval/circuitList?materialNo=${item.materialNo}&taskId=${item.id}&offShelvesQty=${item.offShelvesQty}`
});
发现在Page_B页面用$route.query接收参数的时候发现在h5页面是好使的但是在打包成app就不好使了,需要使用onload来接收,感觉很像小程序写法onLoad(o- 阅读剩余部分 -
最近在折腾uniapp 需要额外传参,这里坐下笔记<uni-easyinput type="text" v-model.trim="item.offShelvesQty" @input="onInputOffShelvesQty($event,index,item)"/>