vue-loader

Why is the vue <template> invalid with v-bind:src?

让人想犯罪 __ 提交于 2021-02-08 10:00:13
问题 I want to dynamically switch html content, so I used vue-loader src to import, but v-bind:src doesn't take effect at all. <template src="./app.html"></template> Ok,effective <template :src="getDOM(true)"></template> getDOM(a){ if(a){ return './app.html' } else { return './app2.html' } } Not active. So, what can I do to achieve this effect? 回答1: It seems like you need to use Vue dynamic components https://vuejs.org/v2/guide/components.html#Dynamic-Components You can make a couple of components

Why is the vue <template> invalid with v-bind:src?

别等时光非礼了梦想. 提交于 2021-02-08 09:58:51
问题 I want to dynamically switch html content, so I used vue-loader src to import, but v-bind:src doesn't take effect at all. <template src="./app.html"></template> Ok,effective <template :src="getDOM(true)"></template> getDOM(a){ if(a){ return './app.html' } else { return './app2.html' } } Not active. So, what can I do to achieve this effect? 回答1: It seems like you need to use Vue dynamic components https://vuejs.org/v2/guide/components.html#Dynamic-Components You can make a couple of components

Changing body styles in vue router

做~自己de王妃 提交于 2021-01-20 15:27:31
问题 I'm using Vue router with two pages: let routes = [ { path: '/', component: require('./components/HomeView.vue') }, { path: '/intro', component: require('./components/IntroView.vue') } ] This works fine, except that each of my components has different body styling: HomeView.vue: <template> <p>This is the home page!</p> </template> <script> export default { } </script> <style> body { background: red; } </style> IntroView.vue: <template> <div> <h1>Introduction</h1> </div> </template> <script>

Vuejs 3: Problem with vue-template-compiler

一曲冷凌霜 提交于 2021-01-13 08:57:10
问题 I am trying to integrate vuejs 3 to an existing project which uses webpack. I read about vue-loader, so I am trying to use it. In the official documentation I have this: Every time a new version of vue is released, a corresponding version of vue-template-compiler is released together. The compiler's version must be in sync with the base vue package so that vue-loader produces code that is compatible with the runtime. This means every time you upgrade vue in your project, you should upgrade

Webpack compile error: TypeError: __WEBPACK_IMPORTED_MODULE_1__ … is not a function

折月煮酒 提交于 2020-12-30 07:53:46
问题 So, this my Api Service Component, I'm using Axios: import api from './Api.vue'; export default { name: 'app-feed-service', methods: { getPosts() { return api.get('posts/'); } } } and some feed component import AppSinglePost from './../Feed/Post.vue'; import AppFeedService from './../../api/Feed.vue'; export default { name: 'app-posts', components: { AppSinglePost }, data() { return { posts: [] } }, created() { AppFeedService.getPosts().then((res) => { console.log(res); }); } } and now the

Webpack compile error: TypeError: __WEBPACK_IMPORTED_MODULE_1__ … is not a function

本小妞迷上赌 提交于 2020-12-30 07:52:04
问题 So, this my Api Service Component, I'm using Axios: import api from './Api.vue'; export default { name: 'app-feed-service', methods: { getPosts() { return api.get('posts/'); } } } and some feed component import AppSinglePost from './../Feed/Post.vue'; import AppFeedService from './../../api/Feed.vue'; export default { name: 'app-posts', components: { AppSinglePost }, data() { return { posts: [] } }, created() { AppFeedService.getPosts().then((res) => { console.log(res); }); } } and now the