vuejs2

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

China☆狼群 提交于 2021-02-07 14:51:14
问题 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. <

How to send an file with $http.post in Vue.Js

荒凉一梦 提交于 2021-02-07 13:45:38
问题 How can I send a file with vue.js? The following code is not working for me: <span title="Upload" class="badge badge-info"> <input type="file" id="file" name="file" @change="uploadData" class="archive" > <i id="iarchive" class="fa fa-upload"></i> </span> When I make console.log(this.request.file) I get FILE [object File] . Here is the .js: uploadData: function(e) { var files = e.target.files[0]; this.request.action = 'upload'; this.request.file = files; console.log("FILE "+this.request.file);

Conditional stylesheet in .vue component

你离开我真会死。 提交于 2021-02-07 13:16:50
问题 I'm working with vue component (cli .vue) I need to have my stylesheet appear only if certain boolean is true/false. Simplest explanation would be something like : When myVar==false , component is not loading styles. <style v-if="myVar" lang="scss"> @import 'mystyles.css' </style> I know it is impossible in that way, but how I'm able to do 'similar' thing? I need to load my styles in vue if user want to use default Styles, if not I need to prevent them from being loaded. My component is used

Conditional stylesheet in .vue component

流过昼夜 提交于 2021-02-07 13:16:41
问题 I'm working with vue component (cli .vue) I need to have my stylesheet appear only if certain boolean is true/false. Simplest explanation would be something like : When myVar==false , component is not loading styles. <style v-if="myVar" lang="scss"> @import 'mystyles.css' </style> I know it is impossible in that way, but how I'm able to do 'similar' thing? I need to load my styles in vue if user want to use default Styles, if not I need to prevent them from being loaded. My component is used

VueJS get data as object

久未见 提交于 2021-02-07 11:16:28
问题 Here is a VueJS component: <template> <a @click="log">click me<a> </template> <script> export default { data() { return { a: "a", b: "something", foo: { bar: "baz" }, // etc. } }, methods: { log() { // console.log( data ); // ??? } } } </script> I want to access the data from the log function and get it as an object (just like in its declaration). I know I can get data like this : log() { console.log( this.a ); console.log( this.b ); console.log( this.foo ); } But what I want is the whole

Proper way to express switch statement with Vue data bindings

孤街醉人 提交于 2021-02-07 10:27:03
问题 I have a simple use case for a range input that changes a button's text whenever the range's value changes. I'm using Vue.js to bind data from an object that is simply storing the range value, and spitting it back out to the button (and the counter, for easier debugging). In the following fiddle, when the range value is greater than 0, the text reads "Buy", or else it reads "Sell". Fiddle: http://jsfiddle.net/svwa79pe/1/ What I want to do is show three button states depending on whether the

Proper way to express switch statement with Vue data bindings

断了今生、忘了曾经 提交于 2021-02-07 10:26:23
问题 I have a simple use case for a range input that changes a button's text whenever the range's value changes. I'm using Vue.js to bind data from an object that is simply storing the range value, and spitting it back out to the button (and the counter, for easier debugging). In the following fiddle, when the range value is greater than 0, the text reads "Buy", or else it reads "Sell". Fiddle: http://jsfiddle.net/svwa79pe/1/ What I want to do is show three button states depending on whether the

VUE 2 with Bootstrap 4 - Radio button action not working when using data-toggle=“buttons”

懵懂的女人 提交于 2021-02-07 07:15:50
问题 I have the following code: <template> <div class="btn-group" data-toggle="buttons"> <label class="btn btn-outline-dark active"> <input type="radio" name="grp" v-model="channel" value="vh1" checked> VH1 </label> <label class="btn btn-outline-dark"> <input type="radio" name="grp" v-model="channel" value="mtv"> MTV </label> </div> </template> <script> export default { data() { return { channel: 'mtv' } }, watch: { channel: function(newValue) { console.log('value has been changed to ' + newValue)

Use font-awesome in a Vue app created with vue-cli webpack

强颜欢笑 提交于 2021-02-07 05:07:13
问题 I'm trying to use the font-awesome in a simple Vue app created with vue-cli using the webpack-simple template, but this is being tricky. I installed font-awesome using npm install font-awesome --save and imported it in my entry js (main.js) import Vue from 'vue' import App from './App.vue' import VueRouter from 'vue-router'; import Home from "./components/Home.vue" Vue.use(VueRouter); import 'font-awesome/css/font-awesome.css'; const routes = [ { path: '/', component: Home } ]; const router =

Use font-awesome in a Vue app created with vue-cli webpack

两盒软妹~` 提交于 2021-02-07 05:05:50
问题 I'm trying to use the font-awesome in a simple Vue app created with vue-cli using the webpack-simple template, but this is being tricky. I installed font-awesome using npm install font-awesome --save and imported it in my entry js (main.js) import Vue from 'vue' import App from './App.vue' import VueRouter from 'vue-router'; import Home from "./components/Home.vue" Vue.use(VueRouter); import 'font-awesome/css/font-awesome.css'; const routes = [ { path: '/', component: Home } ]; const router =