vuejs2

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

axios response headers missing data when running in vuejs app

社会主义新天地 提交于 2021-02-08 09:44:26
问题 I have simple vuejs application. In the main.js I have something like: import Vue from "vue"; import App from "./App.vue"; import router from "./router/routes"; import store from "./store/root"; import vuetify from "./plugins/vuetify"; import { RootActions } from "./constants"; import axios from "axios"; axios.get("https://api.github.com/users/mzabriskie").then(function(response) { console.log({ headers: response.headers }); }); In the chrome console log I got these: However in https://runkit

Vue custom directive uses the updated Dom (or $el)

泄露秘密 提交于 2021-02-08 07:36:45
问题 I want to design one custom directive to replace 'cx' to <strong>cx</strong> for all TextNodes in the Dom Tree. Below is what I had tried so far: Vue.config.productionTip = false function removeKeywords(el, keyword){ if(!keyword) return let n = null let founds = [] walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false) while(n=walk.nextNode()) { if(n.textContent.trim().length < 1) continue founds.push(n) } let result = [] founds.forEach((item) => { if( new RegExp('cx', 'ig').test

Vue.js using local javascript file functions in component: Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_0__.writeSomething is not a function

你离开我真会死。 提交于 2021-02-08 06:47:48
问题 I am trying to import a local JS file into a single file component in a Vue application. My application is a scaffold generated by vue-CLI (ver 3.8.2). Here are my relevant code snippets (all other code in application is unchanged from generated code): /path/to/app-vue/src/components/HelloWorld.vue <template> <div class="hello"> <Module1/> </div> </template> <script lang="ts"> import { Component, Prop, Vue } from 'vue-property-decorator'; import Module1 from './Module1.vue'; @Component({

How to test for the existance of a bootstrap vue component in unit tests with jest?

孤者浪人 提交于 2021-02-08 02:36:12
问题 So I have some code that has a b-form-input component and I am testing whether that component renders. I am using wrapper.find({name: "b-form-input"}).exists() to determine whether that bootstrap vue component exists. However this function continually returns false when I know that the component is rendering. Could I have some help on how to do this correctly? 回答1: Looking at the bootstrap-vue source code, it looks like the name of the element is BFormInput and not b-form-input (it was

Vue app doesn't load when served through Python Flask server

我是研究僧i 提交于 2021-02-07 19:11:05
问题 I have a simple "hello world" VueJS app I'm trying to get working: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="https://unpkg.com/vue"></script> </head> <body> <div id="app"> Message: {{ message }} </div> <script> var vm = new Vue({ el: "#app", data: { message: "Hello, world" } }); </script> </body> </html> When I load this file in the browser, off my local disk (ie: file:///home/user/vue-project/index

Vue app doesn't load when served through Python Flask server

﹥>﹥吖頭↗ 提交于 2021-02-07 19:10:01
问题 I have a simple "hello world" VueJS app I'm trying to get working: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="https://unpkg.com/vue"></script> </head> <body> <div id="app"> Message: {{ message }} </div> <script> var vm = new Vue({ el: "#app", data: { message: "Hello, world" } }); </script> </body> </html> When I load this file in the browser, off my local disk (ie: file:///home/user/vue-project/index

Vue app doesn't load when served through Python Flask server

南笙酒味 提交于 2021-02-07 19:05:26
问题 I have a simple "hello world" VueJS app I'm trying to get working: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="https://unpkg.com/vue"></script> </head> <body> <div id="app"> Message: {{ message }} </div> <script> var vm = new Vue({ el: "#app", data: { message: "Hello, world" } }); </script> </body> </html> When I load this file in the browser, off my local disk (ie: file:///home/user/vue-project/index

v-card-media with base64 image

谁都会走 提交于 2021-02-07 18:22:59
问题 I am creating a captcha image in ColdFusion and returning it as a REST feed with Taffy. It is then shown in Vuetify ColdFusion / Taffy code <cfscript> component extends="taffy.core.resource" taffy_uri="/captcha" { function get() hint="Sends one out" { var captcha = CreateUUID().right(4) & DayOfWeekAsString(DayOfWeek(now())).left(1).lcase() & "!"; // This is ColdFusion var tempFile = "ram:///#captcha#.txt"; var myImage = ImageCreateCaptcha(100, 300, captcha, "low"); ImageWriteBase64(myImage,

Vue.js not rendering when trying to generate a PDF using Phantom.js

雨燕双飞 提交于 2021-02-07 14:52:24
问题 In this simple example with hardcoded url my Vue.js components not rendering, plain html get rendered but all places i have a component appear blank. Phantom.js should work normally with Vue.js? var webPage = require('webpage'); var page = webPage.create(); page.viewportSize = { width: 1920, height: 1080 }; page.open("-----------", function start(status) { page.render('test.jpeg', {format: 'jpeg', quality: '100'}); phantom.exit(); }); Quick vue code for who want to help and do the test. <