首页 > 其他分享 >17、移动端草稿

17、移动端草稿

时间:2023-04-03 14:46:00浏览次数:47  
标签:草稿 idx formData item 17 移动 data class name


https://www.cnblogs.com/fuckingPangzi/p/10462441.html
小程序的业务域名和服务器域名的区别

服务器域名是 wx.request 请求 去拉取数据的域名。 一般返回为JSON字符串

业务域名是小程序的webview组件要引入的其他H5地址的URL的域名或者网页里面的iframe的域名

 

 

 

 

如果需要跳过----网络请求域名----的校验,可勾选项目设置里的 “不校验合法域名、web-view(业务域名)、TLS 版本以及 HTTPS 证书” 选项。

点击工具栏上的预览按钮即可在真机上预览体验。在真机上如需跳过----网络请求域名----的校验,需要点击右上角选项,选择 “打开调试” 即可。

 

 

(1)index.html <head>   <title><%= htmlWebpackPlugin.options.title %></title> </head> (2)router.js const routes = [     {         path: '/',         name: 'Index',         component: () => import( /* webpackChunkName: "about" */ '../views/Index.vue'),         meta: {title: '游戏活动'}     } ] const router = new VueRouter({     routes }) router.beforeEach((to, from, next) => {     /* 路由发生变化修改页面 title */     if (to.meta.title) {       document.title = to.meta.title //给title赋值     }     next() }) (3)main.js Vue.directive('title', {//单个修改标题     update: function (el) {       document.title = el.getAttribute("data-title") //给title赋值     } }) (4)form.vue <template>     <div class="page">         <div v-title :data-title="basicData.gameName" ></div>       </div> </template>

 

 

  

八、移动端vant-ui相关 1、<input type="value"> (1)button,定义可点击按钮(多数情况下,用于通过 JavaScript 启动脚本) (2)checkbox,定义复选框 (3)file,定义输入字段和 "浏览"按钮,供文件上传 (4)hidden,定义隐藏的输入字段 (5)image,定义图像形式的提交按钮 (6)password,定义密码字段,该字段中的字符被掩码 (7)radio,定义单选按钮 (8)reset,定义重置按钮,重置按钮会清除表单中的所有数据 (9)submit,定义提交按钮,提交按钮会把表单数据发送到服务器 (10)text,定义单行的输入字段,用户可在其中输入文本,默认宽度为 20 个字符 2、深度选择器 当 <style scoped>只作用于当前组件中的元素,可采用下列方式影响到子组件 (1)混用本地和全局样式 <style>/ * 全局样式 */     .wrap .child {           color: red;     } </style> <style scoped> /* 本地样式 */    </style> (2) >>> 深度作用选择器(只作用于css) <style scoped>     .wrap >>> .child {       color: red;     } </style> (3)deep <style scoped>     .wrap /deep/ .child {       color: red;     } </style> 3、移动端的长度单位 (1)%,相对于父元素的尺寸 (2)em,相对于父字体大小 (3)rem,相对于根字体大小 (4)vw,viewpoint width,视窗宽度,1vw等于视窗宽度的1%,如width: calc(100vw - 260px);font-size: 5vw; (5)vh,viewpoint height,视窗高度,1vh等于视窗高度的1%,如height: calc(100vh - 260px);font-size: 5vh; (6)vmin:vw和vh中较小的那个。做移动页面开发时,如果使用 vw、wh 设置字体大小(比如 font-size: 5vw),在竖屏和横屏状态下显示的字体大小是不一样的。 (7)vmax:vw和vh中较大的那个。vmin或vmax,是当前vw和vh中,较小或较大的那个,用vmin或vmax,使得文字大小在横竖屏下保持一致 附、媒体查询 @media screen and (min-width: 360px) and (max-width: 700px){     padding-left: 15%; } 4、vant-ui之van-field (1)Affix (2)输入框,正常 (3)文本框,type="textarea" (4)下拉框的逻辑 A、输入框禁用,右侧添加三角, B、点击事件让下方气泡出现、传出序号、计算-从总数据中找出的相关数据-成下拉选项, C、点击事件从自身数据中找出的相关数据-成为下拉选项,气泡出现 D、点击确定时,给对应的v-model赋值,气泡消失 (5)其它,用插槽input, A、自定义输入框,使用此插槽后,与输入框相关的属性和事件将失效 B、在Form组件进行表单校验时,会使用input插槽中子组件的value,而不是Field组件的value (6)<van-uploader/>的部分属性 A、capture,图片选取模式,可选值为camera,直接调起摄像头 B、after-read,文件读取完成后的回调函数 C、before-read,文件读取前的回调函数,返回false可终止文件读取,支持返回Promise 5、插槽input示例 (1)html部分 <van-form @submit="beforeSubmit" ref="form" >     <template v-for="(item,idx) in formList" >         <div class="sign-form" :key="idx" v-if="item.inputType == 0">             <van-field name="name" :rules="[{ validator: valiFormData, message: '请输入正确内容',index:idx }]"  show-word-limit               :label="item.topicName" v-model="formData[idx]"   :placeholder="'请输入'+item.topicName" :maxlength="item.numLimit" />         </div>         <div class="sign-form" :key="idx" v-if="item.inputType == 1">             <van-field   rows="4" :rules="[{ validator: valiFormData, message: '请输入正确内容',index:idx }]" autosize               v-model="formData[idx]"   :label="item.topicName" type="textarea" show-word-limit/>         </div>         <div class="sign-form" :key="idx" v-if="item.inputType == 2">             <van-field :label="item.topicName" v-model="formData[idx]"  right-icon="arrow-down" readonly placeholder="请选择"               :rules="[{ validator: valiFormData, message: '请输入正确内容',index:idx }]"  @click="changeCol(idx)"  />         </div>         <div class="sign-form" :key="idx"  v-if="item.inputType == 3 && item.isCheckbox == 0">             <van-field   :label="item.topicName" :rules="[{ validator: valiFormData, message: '请输入正确内容',index:idx }]"  >                 <template #input>                     <van-radio-group  v-model="formData[idx]"  direction="horizontal" class="hor-style">                         <van-radio v-for="(v,k) in JSON.parse(item.optionInfo)" :name="v.option" :key="k">{{v.option}}</van-radio>                     </van-radio-group>                 </template>             </van-field>         </div>         <div class="sign-form" :key="idx" v-if="item.inputType == 3 && item.isCheckbox == 1">             <van-field   :label="item.topicName" :rules="[{ validator: valiFormData, message: '请输入正确内容',index:idx }]"  >                 <template #input>                     <van-checkbox-group v-model="formData[idx]" :max="item.selectLimitMax ? item.selectLimitMax : 0"  direction="horizontal">                         <van-checkbox v-for="(value,key) in JSON.parse(item.optionInfo)"  :name="value.option" shape="square" :key="key">{{value.option}}</van-checkbox>                     </van-checkbox-group>                 </template>             </van-field>         </div>         <div class="sign-form" :key="idx" v-if="item.inputType == 4">             <div class="van-form_card">                 <div class="field__label">{{item.topicName}}</div>                 <div class="field__desc">支持“图片”扩展名:png、gif、jpeg、pcx、psd、tiff</div>             </div>             <van-field name="name" type="hidden" :rules="[{ validator: valiFormData, message: '请输入正确内容',index:idx }]"  v-model="formData[idx]"   >                 <template #input>                     <div class="upload-preview">                         <van-image v-if="formData[idx]" width="4rem" height="3rem" fit="contain" :src="formData[idx]" />                         <van-uploader :before-read="uploadFile"  accept="image/png,image/gif,image/jpeg,image/pcx,image/psd,image/tiff" :name="idx">                             <van-icon name="plus"/>                         </van-uploader>                     </div>                 </template>                 </van-field>         </div>             <div class="sign-form" :key="idx" v-if="item.inputType == 5">             <div class="van-form_card">                 <div class="field__label">{{item.topicName}}</div>                 <div class="field__desc">支持“视频”扩展名:avi、MP4、rmvb</div>             </div>             <van-field name="name" type="hidden" :rules="[{ validator: valiFormData, message: '请输入正确内容',index:idx }]"  v-model="formData[idx]">                 <template #input >                     <div class="flex-col">                     <div class="video-upload" v-if="showUpload">                         <span>视频上传中...</span>                         <van-progress :show-pivot="false" :percentage="videoUploadPercent" />                     </div>                     <span class="link" v-if="formData[idx]" @click="href(idx)">{{videoName[idx]}}</span>                     <van-uploader :before-read="uploadVideo" accept="*" v-if="!showUpload"  :name="idx">                         <van-button icon="plus" type="primary">上传视频</van-button>                     </van-uploader>                     </div>                 </template>              </van-field>         </div>             <div class="sign-form" :key="idx" v-if="item.inputType == 6">             <div class="van-form_card">                 <div class="field__label">{{item.topicName}}</div>                 <div class="field__desc">支持“文件”扩展名:doc、docx、txt、pdf、pptx、ppt、xlsx、xls</div>             </div>             <van-field name="name" type="hidden" :rules="[{ validator: valiFormData, message: '请选择',index:idx }]"  v-model="formData[idx]"   >                 <template #input >                     <div class="flex-col">                         <span class="link" v-if="formData[idx]" @click="href(idx)">{{formData[idx]}}</span>                         <van-uploader :before-read="uploadFile" accept=".doc, .docx, .txt, .pdf, .pptx, .ppt, .xlsx, .xls" :name="idx">                             <van-button icon="plus" type="primary">上传文档</van-button>                         </van-uploader>                     </div>                 </template>              </van-field>         </div>         <div class="sign-form" :key="idx" v-if="item.inputType == 7">             <van-field readonly @click="clickDatePicker(idx)" name="name" :rules="[{ validator: valiFormData, message: '请选择日期',index:idx }]"               :label="item.topicName" v-model="formData[idx]"  :placeholder="'请选择'+item.topicName" />             <van-popup v-model="showDatePicker" position="bottom">                 <van-picker                     show-toolbar                     title="选择日期"                     :columns="dateCol"                     @cancel="showDatePicker = false"                     @confirm="dateConfirm"/>             </van-popup>         </div>     </template>     <div class="vt-foot ">         <van-button :loading="loading" loading-text="保存中..."  native-type="submit" block color="#fdb235">提交</van-button>     </div> </van-form> (2)js部分 A、上传图片 uploadFile(file,detail){     let formData=new FormData();     formData.append('file',file);     axios.post(this.$upload,formData,{         'Content-Type':'multipart/form-data'     }).then(res=>{         if(res.data && res.data.code === 10000){             this.formData[detail.name] = res.data.data;             let temp = res.data.data;             this.formData.splice(detail.name,1,temp);         }else{             this.$dialog.alert({             title: '提示',             message: '上传文件失败',             theme: 'round-button',             }).then(() => {             // on close             });         }     }) }, B、上传视频 uploadVideo(file,detail){     let type = file.name.substring(file.name.lastIndexOf(".") + 1).toLowerCase()     if(this.videoType.indexOf(type) < 0 || file.type.indexOf("video") < 0){         this.$dialog.alert({             title: '提示',             message: '仅支持 .avi, .mp4, .rmvb, .mov 格式的视频',             theme: 'round-button',         });         return;     }     let max = 1024*1024*1024;     if(file.size > max){         this.$dialog.alert({             title: '提示',             message: '上传视频大小不能超过 1G!',             theme: 'round-button',         }).then(() => {});         return;     }     getALiYunOSSToken({         tokenName: "ios",     }).then(data=>{         let client = new OSS({             region: "oss-cn-beijing",             accessKeyId: data.data.data.accessKeyId,             accessKeySecret: data.data.data.accessKeySecret,             bucket: data.data.data.bucketName,             stsToken: data.data.data.securityToken,         });         const suffix = file.name.substr(file.name.indexOf("."));         let fileUrl = `test/${new Date().getTime()}${suffix}`;         client             .multipartUpload(fileUrl, file, {             progress: (p) => {                 this.videoUploadPercent = Math.round(p * 100);                 this.showUpload = true;             },             partSize: 102400,             })             .then((res) => {                 this.showUpload = false;                 this.videoName[detail.name] = res.name;                 let url = res.res.requestUrls[0];                 this.formData[detail.name] = url.substring(0,url.indexOf("?"));                 let temp = this.formData[detail.name];                 this.formData.splice(detail.name,1,temp);                               })             .catch((err) => {                 this.showUpload = false;                 console.log(err);                 this.$dialog.alert({                 title: '提示',                 message: '上传失败',                 theme: 'round-button',})         });     }) },

标签:草稿,idx,formData,item,17,移动,data,class,name
From: https://www.cnblogs.com/gushixianqiancheng/p/17279737.html

相关文章

  • 【微信小程序-原生开发】实用教程17 - 详情页触发列表页刷新,点击图片放大预览,转发给好
    详情页触发列表页刷新需求描述:在详情页进行点赞/收藏操作,再返回到列表页,发现列表页并没有同步更新点赞/收藏的状态。解决方案:在详情页执行任何触发列表页展示内容的数据更新时,都同步执行列表页的刷新代码实现:因列表页通常为详情页的上一页,所以详情页触发列表页的刷新实际上是触发上......
  • VS2017 未能正确加载“ReferenceManagerPackage”包
    MicrosoftVisualStudio未能正确加载“ReferenceManagerPackage”包。1.以管理员身份打开DeveloperCommandPromptforVS20172.定位到你的vs2017的安装目录我安装的是企业版就是E:\ProgramFiles(x86)\MicrosoftVisualStudio\2017\Enterprise\Common7\IDE\PublicAssemblies......
  • 记一次移动硬盘修复
    记一次移动硬盘修复帮师弟装ubuntu,但是移动硬盘没拔,结果把系统撞到移动硬盘上去了。硬盘无有用数据,但是插上windows无盘符显示。磁盘管理windows磁盘管理,删除其他分区,但是EFI分区无法删除。参考链接#运行DiskpartlistdiskselectdiskNclean删除完EFI分区之后,回......
  • Ubuntu 17.04 将取消 Swap 分区?
    Canonical的软件工程师DimitriJohnLedkov最近宣布即将发布的Ubuntu Linux 系统安装时将丢弃Swap分区方式,改为交换文件方式。对我们中的大多数使用带SSD或NVMe闪盘及内存充足的人来说,这不是什么大新闻。不过那些想要将Ubuntu后续版本安装在10多年前PC......
  • Ubuntu 17.04 将取消 Swap 分区?
    Canonical的软件工程师DimitriJohnLedkov最近宣布即将发布的Ubuntu Linux 系统安装时将丢弃Swap分区方式,改为交换文件方式。对我们中的大多数使用带SSD或NVMe闪盘及内存充足的人来说,这不是什么大新闻。不过那些想要将Ubuntu后续版本安装在10多年前PC......
  • day17| 110.平衡二叉树;257.二叉树的所有路径;404.左叶子之和
    110.平衡二叉树 自顶向下递归 1.获得计算二叉树高度的函数2.对于遍历到的节点,首先计算左右子树的高度,看是否平衡3.在分别遍历到左右子树,判断左子树和右子树是否平衡 代码如下:classSolution:defisBalanced(self,root:TreeNode)->bool:defhei......
  • 洛谷P1217 [USACO1.5]回文质数 Prime Palindromes
    #include<bits/stdc++.h>usingnamespacestd;inta,b;boolzs(intx){if(x%2>0){for(inti=3;i<x;i+=2)if(x%i==0)returnfalse;returntrue;}elsereturnfalse;}boolhws(intx......
  • 17.内网渗透基础
    内网渗透基础目录内网渗透基础一、内网介绍1、工作组2、域3、域类型:4、域术语:二、内网信息收集1、域信息收集命令:2、找域控命令3、主机发现三、LM和NTLM四、哈希抓取五、内网横向一、内网介绍1、工作组工作组(WorkGroup)是局域网中的一个概念。它是最常见最简单最普通的资源管......
  • 代码随想录Day17-Leetcode110.平衡二叉树,257. 二叉树的所有路径,404.左叶子之和
    110.平衡二叉树题目链接:https://leetcode.cn/problems/balanced-binary-tree/一个显然但似乎不太高效的方法是:通过递归获取左右子树高度,判断差;然后递归判断左右结点;那么一个显然的改进就是后序遍历/***Definitionforabinarytreenode.*functionTreeNode(val......
  • 虚拟机vmware17官方下载安装教程
    进入Vmware官网  在搜索框中输入WorkStationPro,并点击查询结果页列表的第一个链接  拖到底部,选择Windows版本下载  点击下一步 点击下一步 选择安装位置并勾选"增强型键盘驱动程序",点击下一步 两个勾选框去掉默认勾选状态,点击下一步  点击下一......