2021-07-14 02:24:29    17    0    0

使用一个空白页来中转

  1. // refresh.vue
  2. <template>
  3. <div></div>
  4. </template>
  5. <script>
  6. export default {
  7. name: "refresh",
  8. data() {
  9. return {}
  10. },
  11. beforeRouteEnter(to, from, next) {
  12. next(vm => {
  13. vm.$router.replace({ path: from.path, query: to.query })
  14. })
  15. }
  16. }
  17. </script>
  18. // router.vue
  19. {
  20. path: "/refresh",
  21. name: "refresh",
  22. component: () =>
  23. import(/* webpackChunkName: "page" */ "@/components/refresh"),
  24. meta: {
  25. keepAlive: false,
  26. isTab: false,
  27. isAuth: false
  28. }
  29. }
  30. // main.js (如果需要设置所有的)
  31. router.beforeEach((to, from, next) => {
  32. if (from.path === to.path) {
  33. next({ path: "/refresh", query: to.query })
  34. return
  35. }
  36. }
2021-06-21 09:36:07    4    0    0
2021-06-20 07:04:02    6    0    0

笔记本有外接鼠标时关闭触摸板

按下WIN键搜索触摸板设置关闭连接鼠标时让触摸板保持打开状态

2021-06-18 10:52:59    5    0    0

npm install vuedraggable

2021-06-09 02:10:33    6    0    0
  1. /**
  2. * 复制文本
  3. * @param text
  4. */
  5. export function copyText(text) {
  6. const input = document.createElement("input")
  7. input.value = text
  8. document.body.appendChild(input)
  9. input.select()
  10. document.execCommand("Copy")
  11. window.setTimeout(function () {
  12. document.body.removeChild(input)
  13. }, 0)
  14. }
  15. /**
  16. * esc监听全屏
  17. */
  18. export const listenfullscreen = (callback) => {
  19. function listen() {
  20. callback()
  21. }
  22. document.addEventListener("fullscreenchange", function () {
  23. listen()
  24. })
  25. document.addEventListener("mozfullscreenchange", function () {
  26. listen()
  27. })
  28. document.addEventListener("webkitfullscreenchange", function () {
  29. listen()
  30. })
  31. document.addEventListener("msfullscreenchange", function () {
  32. listen()
  33. })
  34. }
  35. /**
  36. * 浏览器判断是否全屏
  37. */
  38. export const fullscreenEnable = () => {
  39. return document.isFullScreen || document.mozIsFullScreen || document.webkitIsFullScreen
  40. }
  41. /**
  42. * 浏览器全屏
  43. */
  44. export const re
2021-05-29 06:08:30    32    0    0
  1. let timer = setTimeout(()=> {})
  2. this.$once("hook:beforeDestroy", () => {
  3. clearTimeout(timer)
  4. timer = null
  5. })
2021-05-28 16:00:51    11    0    0

组件: countDown.vue

  1. <template>
  2. <div class="countDown_container">
  3. <slot v-bind="dateData"></slot>
  4. </div>
  5. </template>
  6. <script>
  7. import dayjs from "dayjs";
  8. export default {
  9. name: "countDown",
  10. props: {
  11. computeEndTimeFlag: Boolean, // 是否计算结束时间
  12. nowTime: {
  13. type: String | Number,
  14. default: () => Date.now()
  15. },
  16. startTime: {
  17. type: String | Number,
  18. },
  19. endTime: {
  20. type: String | Number,
  21. required: true,
  22. },
  23. showDay: Boolean,
  24. },
  25. data() {
  26. return {
  27. dateData: {},
  28. realEndTime: null,
  29. }
  30. },
  31. created() {
  32. const realEndTime = this.computeEndTimeFlag ? new Date(this.endTime).getTime() : this.getRealEndTime()
  33. this.realEndTime = realEndTime
  34. this.$emit("getRealEndTime", realEndTime)
  35. this.setDateData(realEndTime - new Date().getTime())
  36. this.updateState();
2021-05-28 15:13:22    7    0    0
2021-05-24 10:41:24    8    0    0
  1. // this.$options.data()//是原始data中的数据
  2. // this.$data //是改变后的data中的数据
  3. this.$root //表示app.vue中data的数据
  4. Object.assign(this.$data, this.$options.data())
2021-05-21 10:16:17    18    0    0
  1. Number.prototype.toFixed = function (n) {
  2. if (n != undefined && (isNaN(n) || Number(n) > 17 || Number(n) < 0)) {
  3. throw new Error("输入正确的精度范围");
  4. }
  5. // 拆分小数点整数和小数
  6. var num = this;
  7. var f = '';
  8. if (Number(num) < 0) {
  9. num = -Number(num);
  10. f = '-';
  11. }
  12. var numList = num.toString().split(".");
  13. // 整数
  14. var iN = numList[0];
  15. // 小数
  16. var dN = numList[1];
  17. n = parseInt(n);
  18. if (isNaN(n) || Number(n) === 0) {
  19. // 0或者不填的时候,按0来处理
  20. if(dN === undefined){
  21. return num + '';
  22. }
  23. var idN = Number(dN.toString().substr(0, 1));
  24. if (idN >= 5) {
  25. if (Number(iN) < 0) {
  26. iN = Number(iN) - 1
  27. } else {
  28. iN = Number(iN) + 1
  29. }
  30. }
  31. return iN + '';
  32. } else {
  33. var dNL = dN === undefined ? 0 : dN.length;
  34. if (dNL < n) {
  35. // 如果小数位不够的话,那就补全
  36. var oldN = num.toString().ind
5/18