美文网首页
music-app项目总结

music-app项目总结

作者: 以手画圆心 | 来源:发表于2018-01-03 17:49 被阅读378次

1.关于项目依赖配置

babel-runtime   //对es6语法做一些转义,(供编译模块复用工具函数)
fastclick       //解决移动端点击300毫秒延迟问题
babel-polyfill  //对es6的一些api做一些转义,比如promise

2.问题总结

1.当出现让你一直安装插件,没有尽头的时候:
        删除node_modules,删除package.json里刚安装的插件
        npm i 
        npm run dev
       查看你的错误
2.sublime3 stylus高亮的方法
   安装插件stylus

3.$refs坑:轮播图刷新出错问题

问题描述:推荐页面轮播图一刷新,变成竖直排列,在代码中随意操作保存后,才正常显示
解决:https://www.jianshu.com/p/bd39302f2492

4.后端代理cannot get /api/getDiscList 404错误

这个主要是由于旧版本dev-server.js和新版本webpack.dev.conf.js导致得,现在配置dev-server直接转移到了webpack.dev.conf中,下面看代码:

在webpack.dev.conf.js编辑
// 后端代理
const express = require('express')
const axios = require('axios')
const app = express()
const apiRoutes = express.Router()
app.use('/api', apiRoutes)

在devserver对象中添加
before(app){
  app.get('/api/getDiscList', function (req, res) {
    let url = 'https://c.y.qq.com/splcloud/fcgi-bin/fcg_get_diss_by_tag.fcg'
    axios.get(url, {
      headers: {
        referer: 'https://c.y.qq.com/',
        host: 'c.y.qq.com'
      },
      params: req.query
    }).then((response) => {
      res.json(response.data)
    }).catch((e) => {
      console.log(e)
    })
  })
},

//截图


image.png

5.(不同浏览器)设置样式封装

let elementStyle = document.createElement('div').style
// 运营商
let vendor = (() => {
  let transformNames = {
    webkit: 'webkitTransform',
    Moz: 'MozTransform',
    O: 'OTransform',
    ms: 'msTransform',
    standard: 'transform'
  }
// 遍历运营商
  for (let key in transformNames) {
    if (elementStyle[transformNames[key]] !== undefined) {
      return key
    }
  }

  return false
})()

export function prefixStyle(style) {
  if (vendor === false) {
    return false
  }
  if (vendor === 'standard') {
    return style
  }
  return vendor + style.charAt(0).toUpperCase() + style.substr(1)
}

这样在使用的时候调用(调用之前需要进入组件):

import {prefixStyle} from 'common/js/dom'
const transform = prefixStyle('transform')

this.$refs.layer.style[transform] = `translate3d(0,${translateY}px,0)`
这一句即可省略
// this.$refs.layer.style['webkitTransform'] = `translate3d(0,${translateY}px,0)`

6.做音乐内核出现如下错误

Uncaught (in promise) DOMException: 
The play() request was interrupted by a new load request.

原因:
当触发mutation 的SET_PLAYING_STATE的时候,同时触发了watch(),watch()中的audio.play()也被触发了,所以,此时应用this.$nextTick包装一层

7.报错 [Do not mutate vuex store state outside mutation handlers]

(意思是提醒:不要在mutaton函数之外修改,一般是因为在action中修改了state的原因)

解决方案1:改为非严格模式
原因:
开启严格模式,仅需在创建 store 的时候传入 strict: true:
const store = new Vuex.Store({
// ...
strict: true
})
在严格模式下,无论何时发生了状态变更且不是由 mutation 函数引起的,将会抛出错误。这能保证所有的状态变更都能被调试工具跟踪到。
解决:改为非严格模式:strict: false

解决方案2:利用slice()


image.png

8报错Unknown custom element: <xxx>-did you register the component correctly?

出错原因:dom标签单词拼写错误

相关文章

  • music-app项目总结

    1.关于项目依赖配置 2.问题总结 3.$refs坑:轮播图刷新出错问题 问题描述:推荐页面轮播图一刷新,变成竖直...

  • vue实战项目music-app报错

    按照上方的书写方法,发现报下方的错 解决方法:将getRecomend.then((res) => {})改为ge...

  • 项目总结-园区项目总结

    今年是自己进入这个行业的第一年,做的第一个项目,项目时间:4月21日-11月8日。总结一下想到的问题,为日后作参考...

  • 【总结】2017.01.01

    2017.01.01 - 计划 2016.12月总结 2017.01月计划 项目总结 - 实际完成 项目总结一,二...

  • 2019-03-28

    总结总结项目的各种功能,写一下项目流程

  • iOS 基于 MVC 的项目重构总结

    iOS 基于 MVC 的项目重构总结 iOS 基于 MVC 的项目重构总结

  • 项目总结

    框架 项目后台采用Springboot+Mybatis的架构,前端使用的Vue框架和ECharts组件,使用Mav...

  • 项目总结

    经过一段时间的学习,智慧社区商超管理系统这个项目结束了,这个项目可分为六个部分: 系统需求分析 系统界面原型设计 ...

  • 项目总结

    将近半年多的时间,从产品到设计再到开发,现在我们的APP终于进入了公测阶段,利用这段比较轻松的时间对APP中用到的...

  • 项目总结

    SOA 面向服务架构 分布式项目的部署特点 真分布式:指的是,每个tomcat都在不同的机器上,通过IP地址来识别...

网友评论

      本文标题:music-app项目总结

      本文链接:https://www.haomeiwen.com/subject/urlwgxtx.html