Current location - Quotes Website - Collection of slogans - Vue cli modify port number Vue modify port number
Vue cli modify port number Vue modify port number
How to modify the default port number through vue cli+webpack to configure the development server in webpack.config.js file.

devServer: {

HistoryApiFallback: That's right,

NoInfo: that's right,

Port: 9 188,//Access terminal

After the installation of vue-cli is completed, npm run dev will report an error, and the word "error report" usually describes the cause of the error.

Maybe beginners ignore these descriptions or don't know what they are talking about.

But I still suggest you post the error report.

Vue cli asked how to set parameters for background data with the help of the work provided by Vue.

What are the questions about the static resource reference of the project built by vue-cli and the path to start the project with npm run dev? *

what can I say? Scaffolding generates configuration files, such as NPM RUN DEV execution node build/dev-server.js ",in your Packjson, as shown below.

"Script": {

"dev": "node building /dev-server.js",

"build": "node build/build.js",

“unit”:“karma start test/unit/karma . conf . js-single-run”,

E2e: "Node Test /e2e/runner.js"

"Test": "npm Operation Unit & National Preventive Mechanism Management e2e",

" lint": "eslint - ext。 js,。 Vue src test/unit/specification test /e2e/ specification "

},

So you must configure the folder you want to start in dev-server.js

*

The directory of static resources also needs to be configured in config/index.js

Assets subdirectory:' static', which is the directory where static resources are configured.

*

The items, paths and permissions generated by scaffolding are all set. You need to modify the configuration file yourself, if necessary, but the modification is risky and necessary.

Label: classic composition Previous: A beautiful poem with paragraphs Next: 50 words about the end of life, 50 words about loving the end of life.

How does vue-cli configure WebStorm users on Macs that support es7 syntax?

Mand+, select the plug-in for deflection settings, and then click Browse Repository. ...

Type "vue" in the window search bar.

Duguan

If you want to highlight the file type option of *. Vue file, find HTML to add *. Vue to highlight it.

How to import the external js of vuecli webpack into DW software is generally to create a new site directory in DW, and then set a folder and the root directory of the site. However, there is a folder of js and css in this directory, which contains files, and then you can see JS and CSS files in DW's station. You can see the next screenshot: 1. Click-"

How to change the automatic default browser in vue-cli and open the default software in the security guard function?

The interface between vue-cli and the background is cross-domain. How to configure the homologous strategy of JavaScript, the source of cross-domain problems, that is, only protocol+host name+port number (if any) is allowed to access each other? In other words, JavaScript can only access and make resources in its own domain, but can't access and operate resources in other domains. In the past, front-end and back-end were mixed together, such as JavaScript directly tuning an Httphandler in the system, so there was no cross-domain problem. However, with the popularity of modern clients, for example, an application usually has a Web terminal, an App terminal and a WebApp terminal, and various clients usually use the same set of post-processing logic, that is, API, and the development of front-end separation is slightly popular. The front end only pays attention to presentation, usually using JavaScript, and the back end usually uses WebService to provide json data for processing logic and data. Generally, front-end and back-end WebServiceAPI are usually deployed on different servers or domain names. In this way, when you request a WebService through ajax, there will be the problem of homologous strategy. It should be noted that the homologous strategy is limited in JavaScript, and Web services can be used in other programming languages, such as C#, Java or iOS, that is, if you develop native applications, there is no such problem. However, if you develop Web or Html5WebApp, you usually use JavaScriptajax to make a request to the Web service and then parse the return value, which may lead to cross-domain problems. Generally speaking, it is easy to think that moving external resources to the same domain can solve the limitations of the same source strategy. That is to say, an Http server page has been developed on the website at the same time, and all JavaScript requests are sent to this page, which calls external WebService in other languages. That is, add a proxy layer. This method can solve the problem, but it is not direct and efficient enough. At present, the common cross-domain solutions are JSONP(JSONwithpadding) and CORS (cross-source resource sharing). Some solutions need client and server to work together, such as JSOP, while others only need services to work together, such as CORS. The following describes how these two cross-domain parties and the server WebService support these two cross-domain schemes. With the support of JSONP and WebService, a server can't get the data outside the server, but the tags such as img, iframe and script are outside, and these tags can request data from other servers through the src attribute. While JSONP is spanned by the script node src.

I don't know what's wrong with vue2.0 vue-cli environment, and how to solve it? I want to know the relationship between the above concepts. I've used gulp, and webpack should be a similar tool. In addition, the example is installed in official website.

Creating a project with vue-cli shows what this means. Vue-cli is an officially recommended scaffold for quickly building single-page applications. Fang's suggestion, if it is the first time to try Vue, let's honestly write js files in ordinary words. There are too many things involved here, such as webpack, npm, nodejs and so on. And it is easy to realize the idea from getting started to giving up. This paper itself follows the construction process in the official documents (official construction suggestions). The first is the construction technology.

First, install node.js

First of all, you need a node environment, and you can download the installation package directly from Chinese official website: //nodejs/.

After the installation is completed, you can enter node -v and npm -v in the command line tool. If the version number can be displayed, the installation is successful.

, install vue-cli.

After installing the node, we can completely install vue-cli:

Npm installation -g vue-cli

Due to various indescribable reasons, npm installation will be slow and easy to make mistakes, so pm installation is recommended.

NPM install-g pm-registry =://registry . NPM . Taobao

After installation, use pm to install vue-cli and webpack.

Pm installation -g vue-cli

After the installation is completed, you can use vue -V to check whether the installation is successful.

Third, generate items.

First, you need to enter the project directory in the command, and then enter:

Vue init web pack Vue- demo

Where webpack is the template name and Vue-demo is the user-defined project name. After executing this command, a project folder with the same name will be generated in the front-end directory.

After the configuration is completed, you can see that there is an additional project folder in the directory, which is the vue.js project based on webpack created by vue-cli.

Then enter the project directory (cd Vue-Project) and install Lai with pm.

Pm installation

Then start the project.

Npm operation and development

Fourth, pack and go online.

Your own project files need to be placed in the src folder.

After the project development is completed, you can enter npm run build to do the package work.

Npm operation construction

After the package is completed, a dist folder will be generated. If the file path is modified, you can directly open the local file for viewing.

When the project goes online, you just need to put the dist file.

Label: classic composition Previous: A beautiful poem with paragraphs Next: 50 words about the end of life, 50 words about loving the end of life.