vue project introduced cdn resources and configuration

1. First cdn added resources in index.html
Here Insert Picture Description

 	<script src="//cdn.bootcss.com/vue/2.3.2/vue.min.js"></script>
    <script src="//cdn.bootcss.com/vue-router/2.5.3/vue-router.min.js"></script>
    <script src="https://cdn.bootcss.com/axios/0.19.0/axios.min.js"></script>
    <script src="https://unpkg.com/mint-ui/lib/index.js"></script>
    <script src="https://unpkg.com/vue-i18n/dist/vue-i18n.js"></script>

2. Open webpack.base.conf.js in bulid folder, plus configuration (note that the variable name and the name of the corresponding prior import)
Here Insert Picture Description

externals: {
    'vue':'Vue',
    'axios':'axios',
    'mint-ui': 'Mint',
    'vue-router':'VueRouter',
    'vue-i18n': 'VueI18n'
  },

3. The mian.js related to the code commented out, there will be some variable error, you can declare a variable as global variables, such as: / *, Ltd. Free Join Vue * /
Here Insert Picture Description
4. Restart to run

Published 14 original articles · won praise 6 · views 6330

Guess you like

Origin blog.csdn.net/weixin_43817709/article/details/99207972