vuejs2

How to change style of background color using Vue.js only

浪子不回头ぞ 提交于 2021-01-27 04:45:12
问题 import Vue from 'vue' import App from './App' import BootstrapVue from 'bootstrap-vue' import 'bootstrap/dist/css/bootstrap.css' import 'bootstrap-vue/dist/bootstrap-vue.css' Vue.config.productionTip = false Vue.use(BootstrapVue); /* eslint-disable no-new */ new Vue({ el: '#app', components: { App }, template: '<App/>' }) <template> <div id="app"> <webpage></webpage> </div> </template> <script> import webpage from "./components/webpage" export default { name: 'app', components : { webpage } }

Vue / Typescript, got Module '“*.vue”' has no exported member

核能气质少年 提交于 2021-01-27 03:57:21
问题 I want to export several interfaces together with Component from .vue file. Basic.vue: <template> <div class="app"> <router-view></router-view> </div> </template> <script lang="ts"> import { Vue, Component } from "vue-property-decorator"; export interface IBasic { name :string; } /** * Simplest container */ @Component export class Basic extends Vue {} export default Basic; </script> But when I import it from another .ts file, I got: What can I do to import the interface successfully? 回答1: You

Vue / Typescript, got Module '“*.vue”' has no exported member

a 夏天 提交于 2021-01-27 03:56:01
问题 I want to export several interfaces together with Component from .vue file. Basic.vue: <template> <div class="app"> <router-view></router-view> </div> </template> <script lang="ts"> import { Vue, Component } from "vue-property-decorator"; export interface IBasic { name :string; } /** * Simplest container */ @Component export class Basic extends Vue {} export default Basic; </script> But when I import it from another .ts file, I got: What can I do to import the interface successfully? 回答1: You

Access props value in another props' validator

陌路散爱 提交于 2021-01-26 04:42:10
问题 I want to access a props value in another props' validator: props: { type: { type: String, default: "standard" }, size: { type: String, default: "normal", validator(value) { // below I want to access the props `type` from above. return (this.type !== "caution" || this.type !== "primary") && value !== "mega" } } } But I'm getting TypeError: Cannot read property 'type' of undefined . Any idea? 回答1: The this variable in a prop's validator does not reference the Vue instance. And, unfortunately,

Optionally import Component in Vue

依然范特西╮ 提交于 2021-01-25 01:42:55
问题 I have several menu types and want to configure the type of menu to be used in .env.local for example: VUE_APP_MENU_TYPE=2 In my javascript file I have the following: let menu = false; if (process.env.VUE_APP_MENU_TYPE === "2") { menu = require("./type2/Type2.vue"); } if (menu === false) {//default menu if env is missing menu = require("./default/Default.vue"); } export default menu; This will result in an error Failed to mount component: template or render function not defined. I can do the

Why does `this` inside filter() gets undefined in VueJS?

风格不统一 提交于 2021-01-21 07:59:07
问题 I am creating a DOB Form. I am using VueJS in the form. The user should their date of month first so that day is displayed according to the number of days in the respective month. I am using filter() and the problem is this inside filter() is undefined. How can I fix this? new Vue ({ el: '.app', data: { months: [ {month: 'January', days: 31}, {month: 'February', days: 28}, {month: 'March', days: 31}, {month: 'April', days: 30}, {month: 'May', days: 31}, {month: 'June', days: 30}, {month:

Why does `this` inside filter() gets undefined in VueJS?

无人久伴 提交于 2021-01-21 07:58:20
问题 I am creating a DOB Form. I am using VueJS in the form. The user should their date of month first so that day is displayed according to the number of days in the respective month. I am using filter() and the problem is this inside filter() is undefined. How can I fix this? new Vue ({ el: '.app', data: { months: [ {month: 'January', days: 31}, {month: 'February', days: 28}, {month: 'March', days: 31}, {month: 'April', days: 30}, {month: 'May', days: 31}, {month: 'June', days: 30}, {month:

v-for without using html element in vue.js

浪尽此生 提交于 2021-01-18 05:23:18
问题 I am newbie to Vue.js I am preparing demo for input elements practices, here is my code. HTML <div id="inputDiv"> <form action=""> <input type="text" v-model="first_name"> <input type="text" v-model="last_name"> <input type="email" v-model="email"> <div> <input type="radio" :name="gender" v-model="gender" value="male">Male <input type="radio" :name="gender" v-model="gender" value="female">Female </div> <textarea v-model="address" id="" cols="30" rows="10"></textarea> <br> <div v-for="hobby in

v-for without using html element in vue.js

混江龙づ霸主 提交于 2021-01-18 05:22:35
问题 I am newbie to Vue.js I am preparing demo for input elements practices, here is my code. HTML <div id="inputDiv"> <form action=""> <input type="text" v-model="first_name"> <input type="text" v-model="last_name"> <input type="email" v-model="email"> <div> <input type="radio" :name="gender" v-model="gender" value="male">Male <input type="radio" :name="gender" v-model="gender" value="female">Female </div> <textarea v-model="address" id="" cols="30" rows="10"></textarea> <br> <div v-for="hobby in

v-for without using html element in vue.js

寵の児 提交于 2021-01-18 05:21:25
问题 I am newbie to Vue.js I am preparing demo for input elements practices, here is my code. HTML <div id="inputDiv"> <form action=""> <input type="text" v-model="first_name"> <input type="text" v-model="last_name"> <input type="email" v-model="email"> <div> <input type="radio" :name="gender" v-model="gender" value="male">Male <input type="radio" :name="gender" v-model="gender" value="female">Female </div> <textarea v-model="address" id="" cols="30" rows="10"></textarea> <br> <div v-for="hobby in