小编Sam*_*ole的帖子

如何测试包含 v-text-field Vuetify 子组件的 vue 组件?

我有一个“EditableText”组件,它显示常规文本,点击后会转换为 vuetify v-text-input 组件(有点像编辑卡片标题时的 trello 功能)。

<template>
  <div class="editableText">
    <div v-if="!editMode" @click="editMode = true" class="editableText__text" :class="textClass">
      {{ this.value }}
    </div>
    <v-text-field
      v-else
      class="editableText__input no-label"
      :class="textClass"
      :value="value"
      :autofocus="true"
      :height="20"
      :single-line="true"
      :hide-details="true"
      @input="handleInput"
      @blur="editMode = false"
    />
  </div>
</template>

<script>
export default {
  data() {
    return {
      editMode: false
    }
  },

  props: {
    value: {
      type: String,
      required: true
    },
    textClass: {
      type: String,
      default: ''
    }
  },

  methods: {
    handleInput(value) {
      this.$emit('input', value)
    }
  }
}
</script>
Run Code Online (Sandbox Code Playgroud)

除了当 VTextField 子组件触发输入事件时我尝试确认 EditableText …

vue.js vuetify.js vue-test-utils

8
推荐指数
0
解决办法
1756
查看次数

是否可以使用 css 设置 div 样式以显示在 Google Maps API 的全屏地图上?

我正在使用 AngularJS、HTML、CSS 和 JQuery 制作一个 Web 应用程序。这个应用程序使用谷歌地图 api,当它全屏显示时,我需要让下面突出显示的 div 出现在地图的顶部。

突出显示 div 的网站

我发现的这个问题的所有解决方案都适用于当地图在浏览器中全屏显示时,但在我的情况下,当地图合法地全屏显示到屏幕边缘时,我需要它来工作。无论我给 .fixed 类多少 z-index,div 都不会出现在谷歌地图全屏上。下面的 HTML、JS 和 CSS:

HTML

<div ng-controller="airQualityCtrl" ng-init="init()">
    <!-- Everything for the air quality page -->
    <div class="row d-flex align-items-stretch" id="input-row">
        <div class="col-7 padding-sm">
            <div class="ui-card" id="input-card">
                <div class="card-title">
                    <h2 class="title text-lg">Choose Location</h2>
                </div>
                <div class="card-content padding-top-md">
                    <div class="form-group">
                        <h3 class="bold text-md no-margin">Location</h3>
                        <input ng-model="location" ng-keyup="submitLocation($event);" class="form-control" type="text" name="location"/>
                    </div>
                    <div class="form-group">
                        <h3 class="bold text-md no-margin">Latitude / Longitude</h3>
                        <input ng-model="location" ng-keyup="submitLocation($event);" class="form-control" type="text" name="location"/>                        
                    </div>
                </div> …
Run Code Online (Sandbox Code Playgroud)

css jquery google-maps google-maps-api-3 angularjs

1
推荐指数
1
解决办法
1247
查看次数

为什么pylint告诉我我的dict属性是一个未定义的变量?

我正在使用为python 3+配置的pylint处理此代码:

import utils

valid_commands = ['category', 'help', 'exit']

def createCategory():
    utils.clear()
    category = {
        name: 'test' <- allegedly undefined
    }
    utils.insertCategory(category)

def listActions():
    utils.clear()
    for command in valid_commands:
        print(command)

def exit():
    utils.clear()

actions = {
    'category': createCategory,
    'help':     listActions,
    'exit':     exit
}

command = ''
while command != 'exit':
    command = input('task_tracker> ')
    if command in valid_commands:
        actions[command]()
Run Code Online (Sandbox Code Playgroud)

我收到这个错误:

在此输入图像描述

我的代码运行正常,但这个错误不会消失的事实让我疯狂.为什么它告诉我这是未定义的?

python pylint python-3.x

1
推荐指数
1
解决办法
420
查看次数