vue-component

How to Access Vue-Loader Components in an HTML File

佐手、 提交于 2019-12-11 03:21:46
问题 I would like to use the modular style and file format of Vue Loader (i.e., where I have a template section, script section and style section in each .vue file). What I can't figure out how to do (or if it is even possible to do) is use my custom templates in an html file. For instance, in the App.vue file I can use the following code: <template> <div id="app"> <message>Hello there</message> </div> </template> This will work to display a custom message component on the home page. What I would

Using “this” in Vuejs 2.0

时光总嘲笑我的痴心妄想 提交于 2019-12-11 03:10:07
问题 I am new in VueJS. I am having a small problem that i could not figure it out. Hope some one can give me a hint. I am creating a voice search button, basically when i click the voice button then it would record my voice and print it out to the input attribute in form. <input type="text" name="inputSearch" id="inputSearch" v-model="inputSearch" class="form-control" x-webkit-speech> This is my script in VueJS <script> export default { data() { return { inputSearch: '', show: false } }, methods:

How can I disable all dot on input type number ? vue.js 2

别来无恙 提交于 2019-12-11 01:57:11
问题 My html code like this : <div id="app"> <input type="number" v-model="quantity"/> </div> My vue component like this : new Vue({ el: '#app', data: { quantity: '' }, watch: { quantity (val) { this.quantity = val.replace('.', '') } } }) Demo and full code like this : https://jsfiddle.net/50wL7mdz/67375/ For example I input 10.2 , it will automatic to be 102 If I input 10..2 , it not automatic to be 102 So if multiple dot, it does not work How can I solve this problem? 回答1: Because you are using

VueJS Accordion Table — Constraints for real time based system

醉酒当歌 提交于 2019-12-11 01:55:15
问题 This question follows on from posted here: VueJS Accordion Table - Appears outside of the table The answer provided by @Bert Evans is good, however, in the system that I'm developing, there are some constraints which is not making it work. The main constraint is the fact that I'm developing a real-time based system, which takes advantage of the store so when something is edited by a user, then the an action is triggered which pulls all the data again from an ajax call. The solution provided

How can I duplicate slots within a Vuejs render function?

这一生的挚爱 提交于 2019-12-11 00:57:24
问题 I have a component which is passed content via a slot. I'm using a render function to output the content. The reason I'm using a render function is because I want to duplicate the content multiple times. When I use this code, everything works fine: render(createElement){ return createElement('div', {}, this.$slots.default); } When I data that is being passed changes, the output changes as well. However, since I want to duplicate the slot content, I'm now trying this: return createElement(

DOM is not updating when props value changes in Vuejs

你。 提交于 2019-12-11 00:24:22
问题 I have a parent and a child. In the parent am passing 3 variables as props to the child. In the Child I am using the watch() to look for varaible changes. When the child is created for the 1st time the watch works as expected but when the data from the props in updated then DOM of the child is not updated. The watch function which is looking for data change of the variable is not running at all. Here is my code. Its a bit lengthy so please bear with it. Parentcomponent.vue <template> <div>

How to solve [Vue warn]: props must be strings when using array syntax?

半世苍凉 提交于 2019-12-10 22:19:29
问题 My view is like this : <div class="col-md-8"> ... <star :value="{{ $data['rating'] }}" :user="{{ $data['user_id']></star> ... </div> My star component is like this : <template> <span class="rating"> <template v-for="item in items"> <label class="radio-inline input-star" :class="{'is-selected': ((value >= item.value) && value != null), 'is-disabled': disabled}"> <input type="radio" class="input-rating" name="input-rating" v-bind:value="item.value" v-model="value" :disabled="disabled" @click=

Prerender vue.js 2.0 component (similar to this.$compile in vue 1)

故事扮演 提交于 2019-12-10 22:01:25
问题 I'm trying to make reusable components for gridstack . I cannot find a simple way to do something similar to this.$compile method from vue 1 . I've seen this example. Here is my vue script: export default { components: { 'horizontal-fab': HorizontalFab, 'd-widget': DWidget }, data () { return { } }, mounted () { var options = { cellHeight: 80, verticalMargin: 10, width: 3 } $('#grid-stack').gridstack(options) }, addWid () { var grid = $('#grid-stack').data('gridstack') grid.addWidget('<d

VueJS exact-active-class

拟墨画扇 提交于 2019-12-10 21:50:02
问题 I have a menu using Router-link, and i want to put class "Active" on "li" when the Router-link was actived. <ul class="nav nav-second-level"> <li v-for="item in menu"> <router-link :to="{ name: somewhere }" tag="a" exact-active-class="IS-ACTIVATED"> {{Name}} </router-link> </li> </ul> Is there a way to set a class to parent using "exact-active-class"? Thanks! 回答1: You can use v-if to check which route you're in and add class if $route.name is somewhere <ul class="nav nav-second-level"> <li v

Prop value in Vuejs child component not available to bind to element attribute

笑着哭i 提交于 2019-12-10 19:27:57
问题 I am working on an admin app in Vuejs with Vuetify, and I have three fields in a form for a user to select a hex color value. To make it easier for the user, I have implemented a color picker based off of this codepen. Here is the ColorPickerButton component: <template> <div ref="colorpicker" class="color-picker-outer"> <span class="color-picker-inner" v-bind:style="{ 'background-color': colorValue}" @click="togglePicker"></span> <chrome-picker :value="colors" @input="updateFromPicker" v-if=