zoukankan      html  css  js  c++  java
  • VUE- 前端插件

    VUE- 前端插件

     1. 开发文档 

    腾讯云开发者手册:https://cloud.tencent.com/developer/devdocs

    1. 日期操作插件 moment

    安装:

    npm install moment --save 

    引用:在入口文件 main.js中导入并使用

    import moment from 'moment'
    
    Vue.prototype.$moment = moment;

    使用:

          var stamp =Date.parse(new Date());
          var curtDate = new Date();
     
          //时间戳 转换成 时间格式
          var date_temp = new Date(stamp);
    
          //时间格式 转换成 时间戳
          var stamp_temp = this.$moment(curtDate).valueOf();
    
          //时间格式化
          var dateT = this.$moment(curtDate).format("YYYY-MM-DD HH:mm:ss");

    2.动态插入图片

    <img :src="item.titleimagepath" />

    数据路径

    ./static/businessImg/passbook.jpg

    视频播放组件

    安装

    cnpm install vue-video-player --save      

    引用:在入口文件 main.js中导入并使用

    import VideoPlayer from 'vue-video-player'  
    import 'vue-video-player/src/custom-theme.css'
    import 'vue-video-player/node_modules/video.js/dist/video-js.css'

    使用:

     <video-player
          class="video-player vjs-custom-skin"
          ref="videoPlayer"
          :playsinline="true"
          :options="playerOptions"
        ></video-player>
     playerOptions: {
            playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
            autoplay: false, // 如果true,浏览器准备好时开始回放。
            muted: false, // 默认情况下将会消除任何音频。
            loop: false, // 导致视频一结束就重新开始。
            preload: "auto", // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
            language: "zh-CN",
            aspectRatio: "16:9", // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
            fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
            sources: [
              {
                type: "",
                src: "./static/upload/love/vdemo.mp4" //url地址
              }
            ],
            // poster: "../../static/images/test.jpg", // 你的封面地址
            //  document.documentElement.clientWidth,
            notSupportedMessage: "此视频暂无法播放,请稍后再试", // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
            controlBar: {
              timeDivider: true,
              durationDisplay: true,
              remainingTimeDisplay: false,
              fullscreenToggle: true // 全屏按钮
            }
          },

    格式支持

       sources: [
            {
              // type: "video/webm", // ok,用ogg也可打开
              type: "video/ogg", // ok,用webm也可打开
              // type: "video/3gp", //ok
              // type: "video/mp4", // ok
              // type: "video/avi", //打不开
              // type: "video/flv", // 打不开
              // type: "video/mkv", // 打不开
              // type: "video/mov", // 打不开
              // type: "video/mpg", // 打不开
              // type: "video/swf", // 打不开
              // type: "video/ts", // 打不开
              // type: "video/wmv", // 打不开
              // type: "video/vob", // 没转化
              // type: "video/mxf", // 转化出错
              // type: "video/rm", // 转化出错
              src: "/static/video/Video_2018-05-15_105711.webm" //本地测试url地址
              // src: 'http://www.html5videoplayer.net/videos/madagascar3.mp4'//url地址
            }
          ]

    样式:

    .video-js {
      font-size: 5px;
      .vjs-big-play-button {
        /*
      播放按钮换成圆形
      */
        height: 2em;
         2em;
        line-height: 2em;
        border-radius: 1em;
      }
    }

    播放问题:

    播放按钮与fastclick冲突

    冲突是这样的:播放器在手机浏览器或者chrome开发者工具(手机尺寸)内,点击播放按钮,播放与暂停事件会被触发多次。

    参考:https://www.zhangshengrong.com/p/zD1yQdLY1r/

    # 插件安装
    # 组件库:cnpm i muse-ui -S
    # axios网络访问: cnpm install axios --save
    # 提示消息: cnpm install muse-ui-toast -S
    # 监听手指滑动 cnpm install vue-touch@next --save
    # Message弹窗 cnpm install -S muse-ui-message
    # moment处理时间戳 cnpm install moment --save
    # 键盘监听 cnpm install vue-awesome-mui --save
    # 图片查看 cnpm install vue-photo-preview --save
    # 视频插件 cnpm install vue-video-player --save      
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
  • 相关阅读:
    leetcode58. 最后一个单词的长度 🌟
    leetcode53. 最大子序和 🌟
    leetcode38. 报数 🌟
    leetcode35. 搜索插入位置 🌟
    leetcode28. 实现strStr() 🌟
    ⚠️ Python 循环列表删除元素的注意事项
    leetcode27. 移除元素 🌟
    leetcode26. 删除排序数组中的重复项 🌟
    javascript 高阶函数 currying & uncurrying
    javascript 高阶函数 实现 AOP 面向切面编程 Aspect Oriented Programming
  • 原文地址:https://www.cnblogs.com/1285026182YUAN/p/12400407.html
Copyright © 2011-2022 走看看