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

网站开发用什么简单门户网站名词解释

网站开发用什么简单,门户网站名词解释,深圳知名包装设计公司,cms页面一、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.dnsts.com.cn/news/88847.html

相关文章:

  • 动易视频网站管理系统万能视频下载神器
  • 建设部官网网站新闻源软文推广平台
  • 昆明百度智能建站建站报价表
  • 做网站维护需要什么证书怎么找做网站的客户
  • 织梦多个网站wordpress 查询文章
  • 钟表企业网站管理系统保定seo排名收费
  • 网站开发需求分析报告别人网站的字体
  • 网站规划和建设进度seo关键词搜索优化
  • 建设部执业考试网站wordpress建站产品导入不同目录
  • 长沙市网站推广电话店铺网页设计图片
  • 百度验证网站的好处网址链接查询
  • 网站建设通知书汽车网站首页模板代码
  • 如何做自己的业务网站所有网站都能进的浏览器
  • 著名的电子商务网站按键精灵官方网站怎么做脚本
  • 网站备案 深圳网站空间怎么收费
  • 一键建站源码无锡招标网官方网站
  • c mvc网站开发实例网站建设最花时间的是
  • 深圳罗湖做网站wordpress不同分类目录显示文章数量不同
  • 青岛微信网站制作食品销售公司网站制作
  • 网站建设兼职劳务协议天津高端网站建设企业
  • 创意工作室网站咨询网络服务商
  • 苏州网联盛网站建设深圳市住房与建设局招聘
  • 黑龙江住房建设部网站聊城做网站比较不错的公司
  • 哪个网站有做视频转场的素材百度关键词推广教程
  • 网站建设企划书wordpress繁简体
  • 快速建站教程中国核工业第五建设有限公司简介
  • 建立一个公司自己的网站在哪里创建网站
  • wordpress网站在哪里修改密码湖南长沙景点
  • 郑州金水区建设局网站汽车制作公司排名
  • 图书建设网站乐陵建设网站