vue-component

VueJs: Using component inside another component

匆匆过客 提交于 2020-04-10 07:13:05
问题 I'm trying to make use of the main component inside another with pre-defined properties. Here's what I'm trying to achieve, but I'm just getting an empty div as a result. <template> <call-dialog-link :id="id" :url=url" message="Are you sure you wish to remove this record?" label="Remove" css-classes="alert" ></call-dialog-link> </template> <script> import CallDialogLink from './CallDialogLink.vue'; export default { props: { id: { type: String, required: true }, url: { type: String, required:

V-model with datepicker input

六月ゝ 毕业季﹏ 提交于 2020-03-22 10:39:22
问题 Trying to build a component that works with daepicker and using v-model to bind the input value. But the input event does not appear to be firing and I can’t seem to figure out why. Here’s my component: <div id="app"> <datepicker v-model="date"></datepicker> </div> Vue.component('datepicker', { template: '<input type="text" class="form-control pull-right" placeholder="dd/mm/aaaa" autocomplete="off">', mounted: function() { $(this.$el).datepicker({ autoclose: true, startView: 'years', }).on(

Vue and TypeScript required prop

旧城冷巷雨未停 提交于 2020-03-22 04:06:33
问题 I added a required prop to my component class using vue-property-decorator , but when I tried using the component without the prop, I didn't see any console errors that indicate the required prop is missing. Why? export default class Test extends Vue { @Prop() private message!: string; } The following code yields no errors as expected: <test message="Hello" /> The following code should result in an error but doesn't: <test /> 回答1: The @Prop decorator takes a PropOptions object, which contains

Vue.js - Add class to clicked button

喜欢而已 提交于 2020-03-16 08:11:30
问题 The following code is meant to display several products displayed by brand. when you press the brand's button it will display its products. this is working fine however I've added a filter to the brands logo so it looks grey until you hover over it. now i want that filter to change to none once you press the button. So far I've only accomplished to remove the filter from all brands which defeats the purpose of highlighting the pressed button. How can i apply the class active to only one

Vue.js - Add class to clicked button

▼魔方 西西 提交于 2020-03-16 08:11:07
问题 The following code is meant to display several products displayed by brand. when you press the brand's button it will display its products. this is working fine however I've added a filter to the brands logo so it looks grey until you hover over it. now i want that filter to change to none once you press the button. So far I've only accomplished to remove the filter from all brands which defeats the purpose of highlighting the pressed button. How can i apply the class active to only one

How to get current route name in Nuxt.js?

自作多情 提交于 2020-02-27 04:38:47
问题 I'm using Nuxt.js for building a static website. How to access in component's script code currently displayed route name (I would like to avoid reading direct url from browser location)? Can I somehow access $route.name ? 回答1: yes you can use vuejs route objects like $route.name or $route.path $nuxt.$route.path return current path $nuxt.$route.name The name of the current route, if it has one. Route Object Properties A route object represents the state of the current active route. It contains

How to get current route name in Nuxt.js?

断了今生、忘了曾经 提交于 2020-02-27 04:36:16
问题 I'm using Nuxt.js for building a static website. How to access in component's script code currently displayed route name (I would like to avoid reading direct url from browser location)? Can I somehow access $route.name ? 回答1: yes you can use vuejs route objects like $route.name or $route.path $nuxt.$route.path return current path $nuxt.$route.name The name of the current route, if it has one. Route Object Properties A route object represents the state of the current active route. It contains

How can I add required validation on filepond vue?

别等时光非礼了梦想. 提交于 2020-02-26 03:42:25
问题 I read on this docs : https://github.com/pqina/vue-filepond I try to add like this : <FilePond allowMultiple="true" accepted-file-types="image/jpg, image/jpeg, application/pdf" maxFileSize="2MB" required="true"/> multiple, validation file type, max file works But, required does not works How can I solve this problem guys? 回答1: Using the v-bind:required prop works: <form method="post" action=""> <file-pond v-bind:required="true"/> <button type="submit">submit</button> </form> Related GitHub

Is allowedDate not usable for async or ajax on the vuetify?

和自甴很熟 提交于 2020-02-25 13:24:31
问题 I want to ask methods: { allowedDates(date) { console.log(date) } }, it will console.log all date on every month selected But if I add script ajax/async like this : methods: { allowedDates(date) { console.log(date) this.getData({appDate: date}); // this is async/call ajax on the vuex store } }, it's async without stopping is allowedDate not usable for async or ajax? docs : https://vuetifyjs.com/en/components/date-pickers#date-pickers-allowed-dates Update I try to testing for make sure like

Is allowedDate not usable for async or ajax on the vuetify?

删除回忆录丶 提交于 2020-02-25 13:24:13
问题 I want to ask methods: { allowedDates(date) { console.log(date) } }, it will console.log all date on every month selected But if I add script ajax/async like this : methods: { allowedDates(date) { console.log(date) this.getData({appDate: date}); // this is async/call ajax on the vuex store } }, it's async without stopping is allowedDate not usable for async or ajax? docs : https://vuetifyjs.com/en/components/date-pickers#date-pickers-allowed-dates Update I try to testing for make sure like