In
'use strict' const utils = require('./utils') const webpack = require('webpack') const config = require('../config') const merge = require('webpack-merge') const path = require('path') const baseWebpackConfig = require('./') const CopyWebpackPlugin = require('copy-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin') const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') const portfinder = require('portfinder') //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------const express = require('express') const axios = require('axios') const app = express() var apiRoutes = () ('/api', apiRoutes) //----------------------------------------------------------------------------------------------------------------------------- const HOST = const PORT = && Number() const devWebpackConfig = merge(baseWebpackConfig, { module: { rules: ({ sourceMap: , usePostCSS: true }) }, // cheap-module-eval-source-map is faster for development devtool: , // these devServer options should be customized in /config/ devServer: { clientLogLevel: 'warning', historyApiFallback: { rewrites: [ { from: /.*/, to: (, '') }, ], }, //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- before(app) { // Recommended Popular Songs ('/api/getDiscList', function(req, res) { var url = '/splcloud/fcgi-bin/fcg_get_diss_by_tag.fcg' (url, { headers: { referer: '/', host: '' }, params: }).then((response) => { () }).catch((e) => { (e) }) }), // Lyrics ('/api/getLyric', function(req, res) { var url = '/lyric/fcgi-bin/fcg_query_lyric_new.fcg' (url, { headers: { referer: '/', host: '' }, params: }) .then((response) => { // convert jsonp data to json data var result = if (typeof result === 'string') { var reg = /^\w+\(({[^()]+})\)$/ var matches = (reg) if (matches) { result = (matches[1]) } } (result) // () }) .catch((error) => { (error) }) }), //Search List Interface // /soso/fcgi-bin/search_for_qq_cp ('/api/search', function(req, res) { var url = '/soso/fcgi-bin/search_for_qq_cp' (url, { headers: { referer: '/', host: '' }, params: }).then((response) => { () }).catch((e) => { (e) }) }) }, //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- hot: true, contentBase: false, // since we use CopyWebpackPlugin. compress: true, host: HOST || , port: PORT || , open: , overlay: ? { warnings: false, errors: true } : false, publicPath: , proxy: , quiet: true, // necessary for FriendlyErrorsPlugin watchOptions: { poll: , } }, plugins: [ new ({ '': require('../config/') }), new (), new (), // HMR shows correct file names in console on update. new (), // /ampedandwired/html-webpack-plugin new HtmlWebpackPlugin({ filename: '', template: '', inject: true }), // copy custom static assets new CopyWebpackPlugin([{ from: (__dirname, '../static'), to: , ignore: ['.*'] }]) ] }) = new Promise((resolve, reject) => { = || ((err, port) => { if (err) { reject(err) } else { // publish the new Port, necessary for e2e tests = port // add port to devServer config = port // Add FriendlyErrorsPlugin (new FriendlyErrorsPlugin({ compilationSuccessInfo: { messages: [`Your application is running here: http://${}:${port}`], }, onErrors: ? () : undefined })) resolve(devWebpackConfig) } }) })
In the interface requesting gold encapsulation
/* *Search list */ export function getSearch(query,page,zhida,perpage) { const url = '/api/search' //Proxy cross-domain enabled // const url ='/soso/fcgi-bin/search_for_qq_cp' (url) const data = ({}, commonParams, { // g_tk:5381, // uin:0, // format:json, // inCharset:utf-8, // outCharset:utf-8, // notice:0, // platform:h5, // needNewCode:1, // w:query, // zhidaqu:1, // catZhida: zhida ? 1 : 0, // t:0, // flag:1, // ie:utf-8, // sem:1, // aggr:0, // perpage:20, // n:20, // p:page, // n: perpage, // remoteplace:, // _:1537612841753 //----------------------------- // w: query, // p: page, // perpage, // n: perpage, // catZhida: zhida ? 1 : 0, // zhidaqu: 1, // t: 0, // flag: 1, // ie: 'utf-8', // sem: 1, // aggr: 0, // remoteplace: '', // uin: 0, // needNewCode: 1, // platform: 'h5', // g_tk:5381, // _:1537612841753 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- g_tk:5381, uin:0, format:'json', inCharset:'utf-8', outCharset:'utf-8', notice:0, platform:'h5', needNewCode:1, w:query, zhidaqu:1, catZhida: zhida ? 1 : 0, t:0, flag:1, ie:'utf-8', sem:1, aggr:0, perpage:perpage, n:20, p:page, remoteplace:'', _:1537612841753 }) return (url, { params: data }).then((res) => { //Return after success return () }) }
Summarize
The above is the latest cross-domain setting method for the vue music app QQ music search list introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!