```
npm? Installation? Jwei Xin- module? -Save
```
2. Create the file share.wx.js
```
//Introduce WeChat jssdk.
const jweixin = require(' jweixin-module ')
const install = (Vue,VM)= & gt; {
// shareInfo: {
//Title:' Title',
// desc:' description',
// link: location.origin,
//imgUrl:'/uploads/we chat _ img/2020/07/29/202007290953 15-5f 20d 68 b 1 ea0d . jpg '
// }
const init =(shareInfo = { })= & gt; {
//Get the WeChat jssdk to share.
vm。 $u.api.getWxjssdk({
url: location.href
}). Then (res =>{
res = res.data
vm。 $u.vuex('vuex_wxjssdk ',res)
console.log(res)
jweixin.config({
Debug: res.debug,//Open the debugging mode, and the return values of all called APIs will come out in the client alarm. If you want to view the incoming parameters, you can open them on the pc side, and the parameter information will be typed out through the log, which will only be printed on the pc side.
AppId: res.appId,//required, the unique identifier of the official account of WeChat.
Timestamp: res.timestamp,//required, generating the timestamp of the signature.
Non castr:RES. non castr,//required, used to generate a random string of signatures.
Signature: res.Signature,//required, signature.
JsApiList: res.jsApiList // required, list of JS interfaces to use.
});
jweixin . ready(()= & gt; {
console.log(shareInfo.title)
//Share with friends
jweixin . updateappmessagesharedata({
Title: shareInfo.title,
desc: shareInfo.desc
Link: shareInfo.link,
imgUrl: shareInfo.imgUrl,
Success: () =>{
//Set successfully
}
})
//Share to friends circle
jweixin . updatetimelinesharedata({
Title: shareInfo.title,
Link: shareInfo.link,
imgUrl: shareInfo.imgUrl,
Success: () =>{
//Set successfully
}
})
//Share to friends circle
jweixin.onMenuShareTimeline({
Title: shareInfo.title,
Link: shareInfo.link,
imgUrl: shareInfo.imgUrl,
Success: () =>{
}
})
//Share with friends
jweixin . onmenushareappmessage({
Title: shareInfo.title,
desc: shareInfo.desc
Link: shareInfo.link,
imgUrl: shareInfo.imgUrl,
Success: () =>{
}
})
});
jweixin.error(function(res) {
//When the verification of configuration information fails, the error function will be executed. If the verification fails due to the expired signature, you can check the specific error information in the debug mode of config or the returned res parameters. For SPA, you can update your signature here.
console.log(res)
});
})
};
//Put all defined interface names into an object and mount it under vm. $u.api (because vm is this, that is, this. $u.api)。
vm。 $u.share = {
initialization
};
}
Export default value {
fix
}
```
3. Add the following to the main.js application. $mount()
```
//WeChat jssdk initialization
Import wxshare from "@/common/share.wx.js"
Vue.use(wxshare,app)
```
Step 4 make a phone call
```
This. $u.share.init({
Title,' Title',
Desc: "description",
Link: location.origin,
ImgUrl: "shared picture address"
})
```