代码拉取完成,页面将自动刷新
https://github.com/ITch8/NetMusic
Vue + VueRouter + vuex + webpack + stylus + VueLazyload
const state = {
singer:{},
playing:false,
fullScreen:false,
playlist:[],
sequenceList:[],
mode:playMode.squence,
currentIndex:-1
}
//例如 获取歌手列表
//代理配置
'/api/getSingers':{
target:'https://u.y.qq.com/cgi-bin/musicu.fcg',
changeOrigin: true,
bypass:function(req,res,proxyOptions){
req.headers.referer='https://u.y.qq.com'
req.headers.host='u.y.qq.com'
},
pathRewrite:{
'^/api/getSingers':''
}
}
//请求
export function getSingerList() {
const url = '/api/getSingers'
const pdata = {
g_tk: 5381,
loginUin: 0,
hostUin: 0,
format: 'json',
inCharset: 'utf8',
outCharset: 'utf-8',
notice: 0,
platform: 'yqq.json',
needNewCode: 0,
data:JSON.stringify({"comm":{"ct":24,"cv":0},"singerList":{"module":"Music.SingerListServer","method":"get_singer_list","param":{"area":-100,"sex":-100,"genre":-100,"index":-100,"sin":0,"cur_page":1}}})
}
return axios.get(url,{
params:pdata
}).then((res)=>{
return Promise.resolve(res.data)
}).catch((err)=>{
console.log(err);
})
}
import {mapGetters} from 'vuex'
export const playListMixin = {
computed:{
...mapGetters([
'playlist'
])
},
mounted(){
this.handlePlayList(this.playlist)
},
activated(){
this.handlePlayList(this.playlist)
},
watch:{
playlist(newVal){
this.handlePlayList(newVal)
}
},
methods:{
handlePlayList(){
throw new Error('components must implement handlePlayList function')
}
}
npm install
npm run dev
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。