Vue.js

How to expose Vue as global object

 ̄綄美尐妖づ 提交于 2021-02-10 23:23:19
问题 I am integrating legacy code with newer one, built with Webpack. In legacy code, plain js accessed Vue simply with: new Vue(...) , from global scope. In Webpack, Vue will get sucked into vendor bundle and I would like to expose Vue back, so my legacy code would still see it as window.Vue What I have done so far (webpack 3.x): { test: require.resolve('vue/dist/vue.esm.js'), use: [{loader: 'expose-loader', options: 'Vue' }] } I get close with this, but I end up with window.Vue.default having

How to expose Vue as global object

不想你离开。 提交于 2021-02-10 23:23:17
问题 I am integrating legacy code with newer one, built with Webpack. In legacy code, plain js accessed Vue simply with: new Vue(...) , from global scope. In Webpack, Vue will get sucked into vendor bundle and I would like to expose Vue back, so my legacy code would still see it as window.Vue What I have done so far (webpack 3.x): { test: require.resolve('vue/dist/vue.esm.js'), use: [{loader: 'expose-loader', options: 'Vue' }] } I get close with this, but I end up with window.Vue.default having

微信生成授权URL

假装没事ソ 提交于 2021-02-10 23:01:27
一 准备工作 1 注册 微信开放平台: https://open.weixin.qq.com 2 邮箱激活 3 完善开发者资料 4 开发者资质认证 准备营业执照,1-2个工作日审批、300元 5 创建网站应用 提交审核,7个工作日审批 6 熟悉微信登录流程 获取access_token时序图 参考文档: https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=e547653f995d8f402704d5cb2945177dc8aa4e7e&lang=zh_CN 第一步:请求CODE(生成授权URL) 第二步:通过code获取access_token(开发回调URL) 二 后端开发 service_ucenter微服务 1 添加配置 open: # 微信开放平台 appid appId: <你的微信开放平台appid> # 微信开放平台 appsecret appSecret: <你的微信开放平台 appsecret> # 微信开放平台 重定向url(guli.shop需要在微信开放平台配置) redirectUri: <你的微信开放平台 重定向url> 2 创建常量类 创建util包

vue3 reactive unexpected behaviour

血红的双手。 提交于 2021-02-10 21:13:22
问题 i've a reactive object, on the save function i call toRaw in order to remove de object reactivity, but, when i change the reactive object props, also the group object is changing.... How??? const newGroup = reactive<Group>({ id: undefined, name: '', enabled: false }) const handleSave = () => { const group = toRaw(newGroup) persist(group).then(() => { newGroup.id = undefined newGroup.name = 'demo' console.log(isReactive(group)) //say false but the group.name value is demo }) } destructuring

vue3 reactive unexpected behaviour

南笙酒味 提交于 2021-02-10 21:13:19
问题 i've a reactive object, on the save function i call toRaw in order to remove de object reactivity, but, when i change the reactive object props, also the group object is changing.... How??? const newGroup = reactive<Group>({ id: undefined, name: '', enabled: false }) const handleSave = () => { const group = toRaw(newGroup) persist(group).then(() => { newGroup.id = undefined newGroup.name = 'demo' console.log(isReactive(group)) //say false but the group.name value is demo }) } destructuring

dynamically setting __webpack_public_path__ does not work after build in vue application

北战南征 提交于 2021-02-10 21:12:03
问题 I have a vue frontend, and spring boot backend application. My application has multiple instances with different url paths (for example /instance1, /instance2), but uses the same build project - meaning every instances runs the same jar. Also the application serves static files - the index.html of the compiled vue application. My problem is that the vue application needs to know dynamically from which url path to get all its static files, so for example when i get the index.html of instance1

Convert Vue.JS project to Nuxt.JS project

泪湿孤枕 提交于 2021-02-10 20:26:59
问题 I want to create Nuxt.JS project from Vue.JS project. Vue.js Project You can see the full Vue.JS project here. This project uses npm package vue-conversational-form which can help turn web forms into conversations using Vue.js. Project has 3 files: index.html index.js myForm.js Code of: index.html <style> html, body { height: 90%; width: 96%; background: #eee; margin: 10px auto; } </style> <div id="app"></div> Code of: index.js import Vue from 'vue' import myForm from './myForm'; new Vue({ el

Laravel Echo not listening for pusher events

爷,独闯天下 提交于 2021-02-10 20:23:48
问题 Trying to create a kind of chat app with laravel and vuejs. Once the message is sent, I fire the event from laravel which reflects on the pusher debug console with the right event class but the listen callback from vuejs is not called at all. created () { window.Echo.channel('chat') .listen('MessageSent', (e) => { console.log(e); //not getting this this.sentMessages.push({ message: e.message.message, user: e.user }); }); }, Below is a screenshot of the debug console from pusher see the image

Laravel Echo not listening for pusher events

梦想与她 提交于 2021-02-10 20:21:52
问题 Trying to create a kind of chat app with laravel and vuejs. Once the message is sent, I fire the event from laravel which reflects on the pusher debug console with the right event class but the listen callback from vuejs is not called at all. created () { window.Echo.channel('chat') .listen('MessageSent', (e) => { console.log(e); //not getting this this.sentMessages.push({ message: e.message.message, user: e.user }); }); }, Below is a screenshot of the debug console from pusher see the image

Vue.js / Vuex + axios sends multiple PUT Request

允我心安 提交于 2021-02-10 19:59:15
问题 The user on my SPA is able to add/update and delete groups. I've set up a Vuex store and an API helper module. In the EditGroup component, a method gets executed when the user press "save changes". The issue is, axios sends 5 to 20 PUT requests but the method gets executed only once. On a GET, POST or DELETE request axios sends one request. In my EditGroup component: saveSelected : function () { this.$store.dispatch(ACTION_PUT_GROUP, { data : this.selected }); }, In my Vuex store: