Home >Web Front-end >JS Tutorial >How to configure config in vue (detailed tutorial)

How to configure config in vue (detailed tutorial)

亚连
亚连Original
2018-06-09 17:30:063947browse

This article mainly introduces the config configuration in vue. This article introduces it to you in great detail and has reference value. Friends who need it can refer to

Configuring aliases in the webpack.base.conf file And the extension name

resolve: {
  extensions: ['.js', '.vue', '.json', '.styl'],
  alias: {
   'vue$': 'vue/dist/vue.esm.js',
   '@': resolve('src'),
   'src': path.resolve(__dirname, '../src'),
   'common': path.resolve(__dirname, '../src/common'),
   'components': path.resolve(__dirname, '../src/components')
  }
 }

After configuring the alias and extension name, main.js can be written like this

import Vue from 'vue';
import App from './App';
import Router from 'vue-router';
//components前面可以加上'@/',也可以省略不写
//如果没有别名,就要写成“import goods from '../components/goods/goods';“
import goods from 'components/goods/goods';
import seller from 'components/seller/seller';
import ratings from 'components/ratings/ratings';
import '@/common/stylus/index';

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

How to configure the babel configuration file in vue-cli

How to use babel installation and configuration tutorial

Use gm to crop composite images under Nodejs

How to call json using js

How to implement it through vuejs Principle of data-driven view

How to use parent component to call child component events in Vue

How to compile, package and view index files in vue

How to implement sliding with fingers in vue

Add and delete attributes dynamically in Vue components

How to deal with the problem of view not updating when object properties are changed in vue?

How to create an instruction to upload photos in AngularJS (detailed tutorial)

The above is the detailed content of How to configure config in vue (detailed tutorial). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn