Applet mpvue

Initialize an mpvue project

1. Create a new folder and execute the following with node.js

  • npm install --global [email protected]
  • vue init mpvue/mpvue-quickstart my-test
    (my-test) is the name to be given
  • Installation dependencies
    • cd my-test
    • npm install·
    • npm run dev

After the successful operation is echoed, you can see that there is an additional dist directory in the local, and this directory is the generated applet related code.
2. Import the WeChat developer tool as an example:
(just find a wx file in the dist file and import it)

Insert picture description here3. Open the code in the src directory in my-test with your own handy editor, as an example:
Insert picture description here
create a new html
, create a new folder in pages, and Insert picture description herefill in the main.js file in the demo folder

import Vue from 'vue'
import App from './index'

// add this to handle exception
Vue.config.errorHandler = function (err) {
    
    
  if (console && console.error) {
    
    
    console.error(err)
  }
}

const app = new Vue(App)
app.$mount()

Open the app.json and modify the order to the first place to display first, and
Insert picture description herefinally restart npm run dev

Guess you like

Origin blog.csdn.net/weixin_54645059/article/details/113721048