0

when i use vue-cli, i import jquery in webpack, and because i use layer.js, so i import jquery in index.html.

webpack.base.conf.js

plugins: [
  new webpack.optimize.CommonsChunkPlugin('common.js'),
  new webpack.ProvidePlugin({
    jQuery: "jquery",
    $: "jquery"
  })
],

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <!--<meta name="viewport" content="width=device-width, initial-scale=1.0">-->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>octet</title>
    <script src="./static/js-spark-md5.js"></script>
    <script src="./static/jquery-2.1.4.js"></script>
    <script src="./static/layer/layer.js"></script>
  </head>
  <body>
  <!--<body data-spy="scroll" data-target="#sidebar">-->
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html>

main.js

new Vue({
  el: '#app',
  store,
  router,
  template: '<router-view></router-view>',
  // components: {template: '<router-view></router-view>'}
})

but chrome shows some errors enter image description here

1 Answer 1

0

i delete import $ from 'jquery' in main.js, then this is no error in console

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.