使用uniapp给小程序添加云函数
过程
"mp-weixin": { "appid": "xxxxxxx", "cloudfunctionRoot": "./functions/" }const path = require('path') const CopyWebpackPlugin = require('copy-webpack-plugin') module.exports = { configureWebpack: { plugins: [ new CopyWebpackPlugin([ { from: path.join(__dirname, './src/functions'), to: path.join(__dirname, 'dist/dev/mp-weixin/functions') } ]) ] } }module.exports = { env: { browser: true, commonjs: true, es2021: true, node: true }, extends: [ 'plugin:vue/essential', 'standard' ], parserOptions: { ecmaVersion: 12 }, plugins: [ 'vue' ], rules: { 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 }, globals: { uni: true, getCurrentPages: true, AndroidObj: true, wx: true, sendApp: true, requirePlugin: true, debugger: true } }<script> export default { onLaunch: function () { console.log('App Launch') // 云函数init wx.cloud.init({ traceUser: true }) }, onShow: function () { console.log('App Show') }, onHide: function () { console.log('App Hide') } } </script># 云开发 => 设置 => 其他设置 => 添加消息推送
参考
Last updated
Was this helpful?