当前位置: 首页 > news >正文

常州制作公司网站六间房直播大厅官网

常州制作公司网站,六间房直播大厅官网,免费网站建站软件,网站与网站链接怎么做一、proxy方式 1.封装日期选择工具函数#xff1a; 在untils文件夹下新建index.ts,并导出工具函数 /*** 获取不同类型日期* param#xff1a;类型 dateVal: 是否指定*/ export function getSystemDate(param: any, dateVal: any) {let systemDate dateVal ? new Date(da… 一、proxy方式 1.封装日期选择工具函数 在untils文件夹下新建index.ts,并导出工具函数 /*** 获取不同类型日期* param类型 dateVal: 是否指定*/ export function getSystemDate(param: any, dateVal: any) {let systemDate dateVal ? new Date(dateVal) : new Date(),year systemDate.getFullYear(),month systemDate.getMonth() 1,date systemDate.getDate(),hours systemDate.getHours(),minutes systemDate.getMinutes(),seconds systemDate.getDate(),milliseconds systemDate.getMilliseconds();month month 10 ? 0 month : month;date date 10 ? 0 date : date;hours hours 10 ? 0 hours : hours;minutes minutes 10 ? 0 minutes : minutes;seconds seconds 10 ? 0 seconds : seconds;if (param 0) {return year - month - date;} else if (param 1) {return year - month - date hours : minutes : seconds;} else if (param 2) {return year - month - date hours : minutes : seconds . milliseconds;} else if (param 3) {return year - month;} else if (param 4) {return year;} }2.引入并挂载到全局 在main.ts中引入后挂载 import { App, createApp } from vue; import App from ./App.vue;import { getSystemDate } from /utils/index; //引入全局使用的方法const app createApp(App);app.config.globalProperties.$getSystemDate getSystemDate; //挂载到全局app.mount(#app); 注意 1.vue3中挂载实例要用app.config.globalProperties.$方法而vue2中挂载实例是Vue.prototype.$方法 3.在页面中按需调用 template部分代码 templatedivel-date-pickerv-modelplantInfo.gridDatetypedateplaceholder选择日期:disabled-datedisabledDate:shortcutsshortcutsformatYYYY-MM-DDstylewidth: 100%//div /template script 中代码 script setup langts namesite import { ref, reactive, getCurrentInstance } from vue;// proxy相当于 vue2的this从getCurrentInstance 实例中获取proxy对象 const { proxy } getCurrentInstance();interface PlantInfo {plantName: any;plantScale: any;sysuserid: any;userDepid: any;gridDate: any;plantNetType: any;voltageLevel: any;prjAddr: any;longitude: any;moduleManufacturer: any;componentBrand: any;componentModel: any;workHours: any;plantStatus: any;roofPitch: any;orientation: any;plantShip: any;plantType: any;streetAddress: any;plantSummary: any;plantImageUrl: any;plantInvestor: any; }const plantInfo refPlantInfo({plantName: ,plantScale: ,sysuserid: ,userDepid: ,gridDate: proxy.$getSystemDate(0),plantNetType: ,voltageLevel: ,prjAddr: ,longitude: ,moduleManufacturer: ,componentBrand: ,componentModel: ,workHours: ,plantStatus: ,roofPitch: ,orientation: ,plantShip: ,plantType: ,streetAddress: ,plantSummary: ,plantImageUrl: ,plantInvestor: });const disabledDate (time: Date) {return time.getTime() Date.now(); }; // 快速日期选择属性 const shortcuts [{text: 今天,value: new Date()},{text: 昨天,value: () {const date new Date();date.setTime(date.getTime() - 3600 * 1000 * 24);return date;}},{text: 一周前,value: () {const date new Date();date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);return date;}} ]; /script 二、provide方式 在Vue 3 TypeScript 中挂载并使用一个全局的工具函数你可以通过 Vue 实例的 provide 和 inject 方法来实现。具体步骤如下 1.创建工具函数 首先创建你的工具函数。 // utils.ts export function myUtilityFunction(): void {// Your utility function logic here } 2.在主入口文件中挂载工具函数 在 Vue 的主入口文件中将工具函数通过 provide 方法挂载到全局。 // main.ts import { createApp } from vue; import App from ./App.vue; import { myUtilityFunction } from ./utils;const app createApp(App);// 将工具函数挂载到全局 app.provide(myUtility, myUtilityFunction);app.mount(#app); 3.在组件中使用工具函数 在需要使用工具函数的组件中通过 inject 方法注入并使用该函数。 !-- MyComponent.vue -- templatedivbutton clickuseUtility使用工具函数/button/div /templatescript langts import { defineComponent, inject } from vue;export default defineComponent({setup() {// 注入工具函数const myUtility inject() void(myUtility);const useUtility () {// 使用工具函数myUtility();};return {useUtility};} }); /script
http://www.zqtcl.cn/news/720194/

相关文章:

  • 网站开发精品课程贵阳市白云区官方网站
  • seo整站优化服务会计培训班一般收费多少
  • 批量网站访问检测怎么做好手机网站开发
  • 深圳网站建设公司哪家比较好shortcodes wordpress
  • 网站内链越多越好嘛可以做3d电影网站
  • 企业网站需求文档微商引流客源最快的方法
  • 交互式网站备案业务网站在线生成
  • 自建网站百度个人网站如何在百度上做推广
  • 如何安装wordpress模板竞价网站做seo
  • 做论坛网站如何赚钱电子商务营销推广
  • 想要自己做一个网站怎么做济宁百度网站建设
  • 海会网络建设网站wordpress刷不出图片
  • 一个人做商城网站网站推广的几个阶段
  • 做国学类网站合法吗html5教程pdf下载
  • 云南省文化馆网站建设二级域名分发平台
  • 网站版面布局结构图网站收录批量查询
  • 网站开发手机模拟器常州到丹阳
  • 淮南医院网站建设班级网站开发报告
  • 东莞营销网站建设哪家好微信api接口
  • 凡科建站怎么导出网页wordpress视频采集插件
  • 个人介绍网站源码云主机上传网站
  • app推广平台网站系统登录入口
  • 做公司宣传册的网站成crm网
  • 新乡公司做网站军事新闻内容摘抄
  • 讯美智能网站建设泰安网络科技有限公司电话
  • 新泰建设局网站北京公司排名seo
  • 新网站上线wordpress用户登陆
  • 景安网站备案表格首页风格
  • 做网站卖菜刀需要什么手续互联网营销顾问
  • 山东鲁中公路建设有限公司网站电商网站建设任务分解结构