【Snippet】uniapp 前端,share-bbs 常用代码片段

一,uview2.0 的官网 API 之 Upload 上传

https://www.uviewui.com/components/upload.html

1,u-search 的三方插件,next-search-select-搜索框组件全端可用

https://ext.dcloud.net.cn/plugin?id=12753

2,cc-numbox自定义商品购物车数字输入框 带加减按钮的数字输入框组件

https://ext.dcloud.net.cn/plugin?id=13163

3,省市区地址选择组件,静态数据,支持回显。

https://ext.dcloud.net.cn/plugin?id=9214

二,uniappd 的官网 API 之 uni.showToast(OBJECT)

https://uniapp.dcloud.net.cn/api/ui/prompt.html#showtoast

6,日期控件,日期的回显:


        <u-form-item label="创建日期" prop="addTime" borderBottom label-width="100px" >
          <u-row justify="space-between" gutter="10">
            <u-col span="6">
              <text u-view-format="date">{{eCustomer.addTime}}</text>
            </u-col>
            <u-col span="6">
              <u-datetime-picker
                  ref="datetimePicker"
                  :show="show_addTime"
                  :maxDate="maxDate"
                  v-model="initDate"
                  mode="date"
                  @confirm="chooseAllTime($event,'addTime')"
                  @cancel="show_addTime = false"
                  @close="show_addTime = false"
              ></u-datetime-picker>
              <u-button @click="show_addTime = true">选择日期</u-button>
            </u-col>
          </u-row>
        </u-form-item>
		
    data() {
		return {
        	maxDate:Number(new Date("2100-01-01")),
        	initDate:Number(new Date()),
			eCustomer:{
addTime:new Date(new Date()).format("yyyy-MM-dd"),
			}
		}
	}
	
	
      chooseAllTime(e,colName){
        //this.show = false
        console.log("--v--",e.value,"--mode--",e.mode,"---colName=",colName)
        console.log("--yyyyy--",new Date(e.value).format("yyyy-MM-dd"))
        if(colName=="addTime"){
          this.eCustomer.addTime=new Date(e.value).format("yyyy-MM-dd");
          this.show_addTime = false;
          console.log("--2222--",this.eCustomer.addTime)
        }else if(colName=="dBusinessSDate"){
          this.eCustomer.dBusinessSDate=new Date(e.value).format("yyyy-MM-dd");
          this.show_dBusinessSDate = false;
          console.log("--2222--",this.eCustomer.dBusinessSDate)
        } 
        console.log("--zzzzz--",this.eCustomer)
        return new Date(e.value).format("yyyy-MM-dd");
      },

4,日期控件,最大日期,初始日期

属性 v-model="dateValue" :maxDate="maxDate" :minDate="todayData" 初始赋值 dateValue: Number(new Date()), maxDate: Number(new Date("2100-01-01")) https://blog.csdn.net/qq_43201350/article/details/135517046

<u-datetime-picker
  :show="dateShow"
  v-model="dateValue"
  mode="date"
  :formatter="formatter"
  :maxDate="maxDate"
  :minDate="todayData"
  @confirm="dateConfirm"
  @cancel="dateCancel"
></u-datetime-picker>
  
data() {
    return {
      dateShow: false,
       dateValue: Number(new Date()),
		maxDate: Number(new Date("2100-01-01"))
    }
  }

5,u-form-item 的 labelwidth

<uni-forms-item label="姓名" label-width="100px" ></uni-forms-item>

https://blog.csdn.net/weixin_60415789/article/details/130239224

6,uniapp 的 loading 组件

uni.showLoading({
	title: '单据数据加载中,请稍等',
});

uni.hideLoading();
end