In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to solve the problem of vuejs without dev". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the problem of vuejs without dev".
There is no dev solution for vuejs: 1, open the webpack-dev-conf.js file; 2, request data through routing; 3, find devServer, and add the before method inside.
This article operating environment: windows7 system, vue2.9.6 version, DELL G3 computer.
How to solve the problem that vuejs does not have dev? The latest vue does not have a dev-server.js file, how to carry out background data simulation?
Dev-server.js has been replaced with webpack-dev-conf.js in the latest vue.
Modify it directly in the webpack-dev-conf.js file when simulating the background data
The first step is to add after const portfinder = require ('portfinder')
/ / first step const express = require ('express') const app = express () / / request servervar appData = require ('.. / data.json') / / load the local data file var seller = appData.seller// to get the corresponding local data var goods = appData.goodsvar ratings = appData.ratingsvar apiRoutes = express.Router () app.use ('/ api', apiRoutes) / / request data via route
Step 2: find devServer and add the before () method to it
DevServer: {clientLogLevel: 'warning', historyApiFallback: true, hot: true, compress: true, host: HOST | | config.dev.host, port: PORT | | config.dev.port, open: config.dev.autoOpenBrowser, overlay: config.dev.errorOverlay? {warnings: false, errors: true}: false, publicPath: config.dev.assetsPublicPath, proxy: config.dev.proxyTable, quiet: true / / necessary for FriendlyErrorsPlugin watchOptions: {poll: config.dev.poll,}, / / the second step is to find devServer and add before (app) {app.get ('/ api/seller', (req, res) = > {res.json ({errno: 0, data: seller}) / / API to return json data The data seller configured above is called after the data request is assigned to}), app.get ('/ api/goods', (req, res) = > {res.json ({errno: 0, data: goods})}), app.get ('/ api/ratings', (req, res) = > {res.json ({errno: 0, data: ratings})})}}
Provide an json.data data
{"seller": {"name": "porridge Xiangfang (Huilongguan)", "description": "hummingbird special delivery", "deliveryTime": 38, "score": 4.2, "serviceScore": 4.1,4.3, "rankRate": 69.2, "minPrice": 20, "deliveryPrice": 4, "ratingCount": 24, "sellCount": 90 "bulletin": "congee Xiangfang, whose secret recipe for cooking congee comes from the thousand-year-old method of China." In Honghe modern production technology, it is developed by Mr. qu Hao, a world master chef. Adhere to the pure natural, 0 added conscience quality has won the favor of consumers, and has so far become the leading brand of porridge. It is the designated catering service provider for the 2008 Olympic Games and the 2013 Garden Expo. " , "supports": [{"type": 0, "description": "online payment full 28 minus 5"}, {"type": 1, "description": "VC unlimited orange juice 20% discount"}, {"type": 2, "description": "single wonderful package"} {"type": 3, "description": "the merchant supports the invoice, please place the order and write the invoice title"}, {"type": 4, "description": "joined the takeout insurance program, food safety"}], "avatar": "http://static.galileo.xiaojukeji.com/static/tms/seller_avatar_256px.jpg"," "pics": ["http://fuss10.elemecdn.com/8/71/c5cf5715740998d5040dda6e66abfjpeg.jpeg?imageView2/1/w/180/h/180"," http://fuss10.elemecdn.com/b/6c/75bd250e5ba69868f3b1178afbda3jpeg.jpeg?imageView2/1/w/180/h/180", "http://fuss10.elemecdn.com/f/96/3d608c5811bc2d902fc9ab9a5baa7jpeg.jpeg?imageView2/1/w/180/h/180", "http://fuss10.elemecdn.com/6/ad/779f8620ff49f701cd4c58f6448b6jpeg.jpeg?imageView2/1/w/180/h/180"]," infos ": [" the merchant supports the invoice, please send the order and write the invoice title "," category: other cuisine, steamed stuffed bun porridge shop "," Unit 1340, Block B, bottom of Longguan Real Estate Building, Huilongguan West Street, Changping District, Beijing " Business hours: 10:00-20:30]} Thank you for your reading The above is the content of "how to solve the problem of vuejs without dev". After the study of this article, I believe you have a deeper understanding of how to solve the problem of vuejs without dev, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.