vue-component

TinyMCE and Vuejs as a component

久未见 提交于 2019-12-05 20:23:23
I am trying to make a Vue Component for TinyMCE but I am facing some problems that I can not solve! Can anybody help me? Or maybe advise a better way to walk ? There is my Component import Vue from 'vue' import _ from 'lodash' export default { props: { model: { default () { return null } }, showLeadInfo: { default () { return false } } }, data() { return { id: 'editor_' + _.random(10000, 99999) } }, watch: { model() { if (this.model == null) tinyMCE.activeEditor.setContent(''); } }, ready() { var vm = this; tinyMCE.baseURL = "/vendor/tinymce/"; tinymce.init({ selector: "#" + vm.id, theme:

How to extend vue component imported from npm package?

我是研究僧i 提交于 2019-12-05 18:42:21
If you have a vue component that is installed via Node : node_modules/vendor/somecomponent.vue Is there any way to modify/extend the template/methods of this component? Update: After trying out the example below, I'm facing this issue: I am using https://github.com/eliep/vue-avatar and I need to extend this with a prop, and maybe amend the template a bit. import {Avatar} from 'vue-avatar' Avatar = Vue.component('Avatar').extend({ props: ['nationality'] }); export default { components: { Avatar }, ... } Results in TypeError: Cannot read property 'extend' of undefined It doesn't appear to be

Components and Sub components

大憨熊 提交于 2019-12-05 18:30:42
I'm new to Vue.js and I'm having a bit of trouble using components with sub-components. I have the following .vue files app.vue <template> <section> <menu></menu> <h1>Create Your MIA</h1> <div id="board"></div> <slider> <skin></skin> </slider> </section> </template> slider.vue <template> <div id="slider-panel"> <h3>{{* heading}}</h3> <div class="slider"> <slot> Some content </slot> </div> </div> </template> <script> import skin from "./skin"; export default { components: { skin: skin } }; </script> skin.vue <template> <div v-for="colour in colours"> <div :style="{ backgroundColor: colour }">

Gulp, Vue, Webpack, Babel and Uncaught SyntaxError: Unexpected token import

拜拜、爱过 提交于 2019-12-05 18:26:02
I've been trying whole day to get it to work without any luck so if someone could shine some light that would be very much appreciated. I'm trying to set up environment for working with ES6 files as well as Vue using Webpack. I've installed all dependencies, and created the following files: webpack.config.js module.exports = { entry: './resources/assets/source/js/app.js', output: { filename: 'app.js' }, devtool: 'source-map', resolve: { alias: { 'vue$': 'vue/dist/vue.js' } }, module: { loaders: [ { test: /\.js$/, loader: 'babel', exclude: /node_modules/, query: { presets: ['es2015'] } }, {

Vue watch[fat arrow scope] providing wrong this context

≯℡__Kan透↙ 提交于 2019-12-05 18:23:12
I am using lodash to debounce a function call but I am wondering why my this value is not inheriting the scope like I expect. These are are the relevant parts of my Vue component. import debounce from 'lodash/debounce'; watch: { query: debounce(() => { this.autocomplete(); }, 200, { leading: false, trailing: true }), The above case does not work because my this value does not point to the Vue component but rather shows an Object like this: Object __esModule: true default: Object __proto: Object Isn't my arrow syntax suppose to inherit the context of this ? The following seem to works fine:

How do I search through multiple fields in Vue.js 2

∥☆過路亽.° 提交于 2019-12-05 18:09:19
I am trying to search or filter through 3 fields firstname, lastname and email in my Vue.js 2 application. I understand that Vue 2 does not come with a built in filter method unlike in Vue 1, hence I created a custom method which is only able to filter through just one field. How do I extend this to multiple fields? I have tried something like this filterBy(list, value1, value2, value3) but it does not work. This is my code <template> <div class="customers container"> <input class="form-control" placeholder="Enter Last Name" v- model="filterInput"> <br /> <table class="table table-striped">

call a function every time a route is updated vue.js

牧云@^-^@ 提交于 2019-12-05 16:18:46
I have integrated intercom in my app and I need to call window.Intercom('update'); every-time my url changes. I know I could add it on mounted() but I rather not modify all my component and do it directly using the navigation guards . (Mainly to avoid to have the same code in 10 different places. At the moment I have: router.afterEach((to, from) => { eventHub.$off(); // I use this for an other things, here is not important console.log(window.location.href ) // this prints the previous url window.Intercom('update'); // which means that this also uses the previous url }) This runs intercom(

Use computed property in data in Vuejs

前提是你 提交于 2019-12-05 13:14:21
问题 How can I use a computed property in the data or emit it via bus? I have the following vue instance, but myComputed is always undefined but computedData is working correctly. var vm = new Vue({ data(){ return{ myComputed: this.computedData } }, computed: { computedData(){ return 'Hello World' } } }) 回答1: To make things as simple as possible, just do the work in watcher, unless you want to emit the changes to different components or there're a lot of variables you want to notify, then you may

vee-validate error object - _vm.errors is undefined

杀马特。学长 韩版系。学妹 提交于 2019-12-05 13:00:37
This is my .vue component file in which I wasn't to use Vue.use() to install vee-validate validation package. The module, as mentioned in the docs, will inject an errors object to the data object. But I do get the error _vm.errors is undefined . I'm not sure if I'm instantiating it properly. Also, will import Vue from 'Vue' and Vue.use(VeeValidate) "use" vee-validate for only this component?(which is what I want it to do). <template> <input class="form-control" name="name" placeholder="Name" type="text" v-model="player.name" v-validate data-vv-rules="alpha|min:2|max:50" :class="{'input': true,

Vue: What is the cleanest way to select a component via CSS?

夙愿已清 提交于 2019-12-05 12:24:15
I have a bar component. It is used like this: <template> <div> <!-- stuff --> <bar></bar> <!-- stuff --> <!-- stuff --> <!-- stuff --> <bar></bar> <!-- stuff --> <bar></bar> <!-- stuff --> </div> </template> <style lang="scss" scoped> @media (max-width: 1300px) { // this selector doesn't work, but it would be nice if it did bar { display: none; } } </style> I would like to hide the bar elements when the screen is 1300px or narrower. It would be nice if there was a bar element selector, just like there are p and h1 element selectors. However, there doesn't seem to be, and I have to add class=