vue-component

Vuetify Styles not visible

筅森魡賤 提交于 2019-12-08 08:22:25
I am a beginner in the world of Vue, so please bear with my foolish question(s). I have a boilerplate code for a Vue project which I cloned from: Vue Enterprise Boilerplate I wanted to use Vuetify components, so I followed the following steps: 1. Cloned the vue-enterprise-boilerplate 2. npm install vuetify --save 3. In my main.js I added the vuetify dependency like: import Vuetify from 'vuetify'; import 'vuetify/dist/vuetify.min.css'; Vue.use(Vuetify); 4. I am using Vue CLI 3 (which comes with the boilerplate), also I have installed the CCS Loader. 5. Now in my app.vue, I have a simple button

Render and Compile String using vue.js

纵然是瞬间 提交于 2019-12-08 08:05:55
问题 There is a requirement where all html elements are defined in a JSON file and used in the template. There is a function - "markComplete" which needs to be triggered on change of a checkbox. Code Template: <template> <span v-html="htmlContent"></span> </template> <script> data(){ return{ htmlContent: "<input type='checkbox' v-on:change='markComplete'>" } } </script> Above code won't work as onChange event won't be mounted, and I get Uncaught ReferenceError: markComplete is not defined Is there

Vuetify Styles not visible

我只是一个虾纸丫 提交于 2019-12-08 07:19:27
问题 I am a beginner in the world of Vue, so please bear with my foolish question(s). I have a boilerplate code for a Vue project which I cloned from: Vue Enterprise Boilerplate I wanted to use Vuetify components, so I followed the following steps: 1. Cloned the vue-enterprise-boilerplate 2. npm install vuetify --save 3. In my main.js I added the vuetify dependency like: import Vuetify from 'vuetify'; import 'vuetify/dist/vuetify.min.css'; Vue.use(Vuetify); 4. I am using Vue CLI 3 (which comes

Validate form input fields in child component from a parent component with Vuelidate

送分小仙女□ 提交于 2019-12-08 06:19:31
问题 I am new to Vue Js and Vuelidate. Just tried to validate form input fields from a parent component like here: https://github.com/monterail/vuelidate/issues/333 Child component in the parent: <contact-list ref="contactList" :contacts="contacts" @primaryChanged="setPrimary" @remove="removeContact" @ready="isReady => readyToSubmit = isReady"/> The method in the child: computed: { ready() { return !this.$v.email.$invalid; } }, watch: { ready(val) { this.$emit('ready', val); } }, methods: { touch(

Vuejs2 update Vue.prototype global object

南楼画角 提交于 2019-12-08 06:15:33
问题 I have create a global object in my main.js to access logged in user's data throughout the application between controllers main.js Vue.prototype.user = getUser() // assume a method to getUser data Now the above .user object will be available in other components with this.user , what I'm looking for is if I make change to this.user in any component, the changes reflects to other components too, this is not happening right now I've two components, one to update data in this.user

Can Vue.js add commas while user typing numbers?

别等时光非礼了梦想. 提交于 2019-12-08 06:04:05
问题 I see this topic, But this is Jquery, how can I change it to Vue.js ? Is v-on supported in Vue.js? Where is my mistake? <div id="vue"> <input v-model="amountModel" v-on:keyup="AddCammas()" value="{{price}}"> </div> <script> el: #vue, methods:{ AddCammas : funtion(){ if(event.which >= 37 && event.which <= 40) return; $(this).val(function(index, value) { this.message = this.amountModel .replace(/\D/g, "") .replace(/\B(?=(\d{3})+(?!\d))/g, ","); }); } } </script> 回答1: You don't need jQuery at

Simulate v-if directive in custom directive

ぐ巨炮叔叔 提交于 2019-12-08 01:12:17
问题 I need to destroy element in custom directive like v-if. (Forbid item creation if the condition fails.) I trying this export const moduleDirective: DirectiveOptions | DirectiveFunction = (el, binding, vnode) => { const moduleStatus = store.getters[`permissions/${binding.value}Enabled`]; if (!moduleStatus) { const comment = document.createComment(' '); Object.defineProperty(comment, 'setAttribute', { value: () => undefined, }); vnode.elm = comment; vnode.text = ' '; vnode.isComment = true;

Vue.js disable component during ajax request

喜夏-厌秋 提交于 2019-12-07 17:56:45
问题 I'm looking for a simple solution for the following problem: I have a Vue component button with which I can make an ajax request. I would like to disable this button while the request is pending (to prevent multiple requests). 回答1: Sounds like you want your action to set (commit) a flag when it starts and then clear it when it ends. Try something like this in Vuex... state: { loading: false }, mutations: { isLoading (state) { state.loading = true }, doneLoading (state) { state.loading = false

Vue async components are loading without delay regardless of the the 'delay' parameter

两盒软妹~` 提交于 2019-12-07 17:19:26
I am using Advanced-Async-Components to load async component after loading of the app. So I have tried the following code: Index.vue <template> <div class=""> <Async></Async> </div> </template> <script> // async component import LoadComp from '@/components/Loading' import ErrorComp from '@/components/Error' const Async = () => ({ // The component to load. Should be a Promise component: import('@/components/Async'), // A component to use while the async component is loading loading: Load, // A component to use if the load fails error: ErrorComp, // Delay before showing the loading component.

Is there a way to route to html files with Vue router?

北慕城南 提交于 2019-12-07 16:52:14
问题 Hello I am using VueJS and the webpack template. I have a bunch of components I can easily display with Vue Router. However, my organization uses Robot Framework for testing and we generate an HTML page using the command: python -m robot.testdoc /tests/directory /destination.html This is basically how I am using the router: import Vue from 'vue' import Router from 'vue-router' import Main from '@/components/Main.vue' import Component1 from '@/components/Component1.vue' import Component2 from