提交 dbf17bbe 编写于 作者: J jqrrgmvtk

Auto Commit

上级 7a093d7e
run = "npm i && npm run dev" run = "npm i && npm run dev"
language = "node"
[deployment] [deployment]
build = "npm i && npm run build" build = "npm i && npm run build"
...@@ -8,3 +9,6 @@ run = "npm run preview" ...@@ -8,3 +9,6 @@ run = "npm run preview"
PATH = "/root/${PROJECT_DIR}/.config/npm/node_global/bin:/root/${PROJECT_DIR}/node_modules/.bin:${PATH}" PATH = "/root/${PROJECT_DIR}/.config/npm/node_global/bin:/root/${PROJECT_DIR}/node_modules/.bin:${PATH}"
XDG_CONFIG_HOME = "/root/.config" XDG_CONFIG_HOME = "/root/.config"
npm_config_prefix = "/root/${PROJECT_DIR}/.config/npm/node_global" npm_config_prefix = "/root/${PROJECT_DIR}/.config/npm/node_global"
[debugger]
program = "main.js"
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
}, },
"dependencies": { "dependencies": {
"guess": "^1.0.2", "guess": "^1.0.2",
"moment": "^2.29.4",
"vue": "^3.2.37" "vue": "^3.2.37"
}, },
"devDependencies": { "devDependencies": {
......
<script setup> <!--
import HelloWorld from './components/HelloWorld.vue' * @Description:
import TheWelcome from './components/TheWelcome.vue' * @Version: 1.0
</script> * @Autor: yyq
* @Date: 2023-02-13 18:56:19
* @LastEditors: yyq
* @LastEditTime: 2023-02-14 22:54:08
-->
<template> <template>
<header> <div id="app">
<img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" /> <div><div style="text-align: left;margin: 45px 0 8px; 0">无参示例:</div></div>
<div class="wrapper"> <TimeLineCanvas></TimeLineCanvas>
<HelloWorld msg="You did it!" /> <div style="text-align: left;margin: 45px 0 8px; 0">指定参数示例:</div>
<TimeLineCanvas
ref="time_line"
@click="clickCanvas"
@change="changeDate"
:mark-time="markTime"
:time-range="timeRange"
:isAutoPlay="isAutoPlay"
:startMeddleTime="startMeddleTime"
/>
<div style="text-align: left;">
<input type="button" @click="setTimeRange" value="设置时间区域" />
<input type="button" @click="setStartMeddleTime" value="设置起点时间" />
<input type="button" @click="setMarkTime" value="设置区域标签" />
<input type="button" @click="setIsAutoPlay" value="开启自动播放" />
<input type="button" @click="stop" value="暂停播放" />
<input type="button" @click="play" value="开启播放" />
</div> </div>
</header> <div style="color: #03A9F4; margin-top: 5px;">{{ msg }}</div>
</div>
<main>
<TheWelcome />
</main>
</template> </template>
<style scoped> <script>
header { import TimeLineCanvas from "./components/timeline-canvas.vue";
line-height: 1.5; import moment from "moment";
} export default {
name: "App",
.logo { components: {
display: block; TimeLineCanvas,
margin: 0 auto 2rem; },
} data() {
return {
@media (min-width: 1024px) { msg: "",
header { isAutoPlay: false,
display: flex; boxwidth: 0,
place-items: center; width: 500,
padding-right: calc(var(--section-gap) / 2); startMeddleTime: "",
} timeRange: [],
markTime: [],
.logo { };
margin: 0 2rem 0 0; },
} methods: {
//设置起点时间
setStartMeddleTime() {
this.startMeddleTime = "2023-02-10 09:01:00";
},
//设置时间区域
setTimeRange() {
this.timeRange = "2023-02-10";
//或
//this.timeRange=["2023-02-10 00:00:00","2023-02-10 23:59:59"];
//起点时间根据timeRange计算(timeRange的中间值)
this.startMeddleTime = null;
},
//设置区域标签
setMarkTime() {
this.markTime = [
{
beginTime: "2023-02-10 06:01:00",
endTime: "2023-02-10 12:02:00",
bgColor: "#FFCC99",
text: "活动",
},
{
beginTime: "2023-02-10 15:01:00",
endTime: "2023-02-10 16:02:00",
bgColor: "#FF6666",
text: "故障",
},
];
},
//开启自动播放
setIsAutoPlay() {
this.isAutoPlay = true;
},
//开启播放
play() {
this.$refs.time_line.play("2023-02-10 13:01:00");
},
//暂停播放
stop() {
this.$refs.time_line.stop();
},
clickCanvas(date) {
console.log(date);
},
changeDate(date, status) {
console.log("changeDate:" + date);
this.msg = "选择时间:" + date + " 播放 状 态:" + status;
},
},
beforeMount() {
let date = "2023-02-06"; //moment(new Date()).format("YYYY-MM-DD");
this.timeRange = date; // [date + " 00:00:00", date + " 23:59:59"];//"2023-2-10"//;
this.startMeddleTime = date + " 00:00:00";
this.markTime = [
{
beginTime: date + " 01:01:00",
endTime: date + " 02:02:00",
bgColor: "#CC3333",
text: "困人",
},
{
beginTime: date + " 08:01:00",
endTime: date + " 10:02:00",
bgColor: "#FF9966",
text: "非法闯入",
},
{
beginTime: date + " 15:01:00",
endTime: date + " 16:02:00",
bgColor: "#FF9900",
text: "故障",
},
];
},
mounted() {},
};
</script>
header .wrapper { <style>
display: flex; #app {
place-items: flex-start; font-family: Avenir, Helvetica, Arial, sans-serif;
flex-wrap: wrap; -webkit-font-smoothing: antialiased;
} -moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
} }
</style> </style>
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册