If I understood correctly this tutorial shows how you use flask and python when the whole index.html is a vue element. I would like to integrate flask and vue and use vue only for a few divs on my page!
I have been able to get some vue functionality by using <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> and defining some vue stuff directly in my script tags in the same html file. I would however like to be able to use Single File Components .vue files which doesn't work for my approach. I imagine I need to use vue create vueproject in my main directory but after that I'm clueless.
Do you have any ideas how to be able to implement vue with full functionality with flask and only embed the vue components in a few divs on my page?
It's the same approach. Here's an example of snippets from index.html and main.js
index.html:
<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content="width=device-width,initial-scale=1.0"><linkrel="icon"href="<%= BASE_URL %>favicon.ico"><title>web</title></head><body><noscript><strong>We're sorry but web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><divid="app1"></div><divid="app2"></div><!-- built files will be auto injected --></body></html>
main.js:
import Vue from 'vue'
import App1 from './App1.vue'
import App2 from './App2.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App1),
}).$mount('#app1')
new Vue({
render: h => h(App2),
}).$mount('#app2')
Remember to build your vue files otherwise it won't work.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If I understood correctly this tutorial shows how you use flask and python when the whole index.html is a vue element. I would like to integrate flask and vue and use vue only for a few divs on my page!
I have been able to get some vue functionality by using
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
and defining some vue stuff directly in my script tags in the same html file. I would however like to be able to use Single File Components.vue
files which doesn't work for my approach. I imagine I need to usevue create vueproject
in my main directory but after that I'm clueless.Do you have any ideas how to be able to implement vue with full functionality with flask and only embed the vue components in a few divs on my page?
It's the same approach. Here's an example of snippets from index.html and main.js
index.html:
main.js:
Remember to build your
vue
files otherwise it won't work.