小编Har*_*tel的帖子

控制台警告:使用v-for呈现的组件列表应具有显式键

我在这里遇到了问题,我不知道我的代码有什么问题,但我在控制台中收到警告,如何删除此警告?

[Vue提示] :: <todo-item v-for="todoItem in todos">使用v-for呈现的组件列表应具有显式键.有关详细信息,请参阅https://vuejs.org/v2/guide/list.html#key.
(找到<Root>)

的index.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Vue Tutorial</title>
        <link rel="shortcut icon" href="https://vuejs.org/images/logo.png">
        <script src="scripts/vue.js"></script>
    </head>
    <body>
        <section id="app">
            <p>{{ msg }}</p>
            <p v-bind:title="message">
                Hover your mouse over me for a few seconds to see my dynamically bound title!
            </p>
            <div>
                <p v-if="seen">This text will show or hide if the button was clicked.</p>
                <button type="button" v-on:click="isSeen">{{ isSeenText }}</button>
            </div>
            <ol>
                <li v-for="todo in …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vuejs2

64
推荐指数
2
解决办法
3万
查看次数

HTML标题图片

我希望在HTML页面中的标题上有一个图像(即在标签上和标题一起).我怎样才能做到这一点?

html favicon

47
推荐指数
3
解决办法
8万
查看次数

如何将推送通知发送到多个设备?

这是我第一次在我的App中使用推送通知.我已经通过示例应用程序和书籍,我得到了如何将推送通知发送到单个设备.但我没有得到我应该在我的程序中做什么更改向多个设备发送推送通知.我正在使用"PushMeBaby"应用程序进行服务器端编码.拜托,帮帮我吧.提前致谢.

iphone push-notification apple-push-notifications

23
推荐指数
1
解决办法
4万
查看次数

将串联字符串分配给python中的变量时,为什么这么慢?

如果仅是如下所示的字符串串联,则立即完成。

test_str = "abcdefghijklmn123456789"
str1 = ""
str2 = ""

start = time.time()
for i in range(1, 100001):

    str1 = str1 + test_str
    str2 = str2 + test_str

    if i % 20000 == 0:
        print("time(sec) => {}".format(time.time() - start))
        start = time.time()
Run Code Online (Sandbox Code Playgroud)

恒定的处理时间

time(sec) => 0.013324975967407227
time(sec) => 0.020363807678222656
time(sec) => 0.009979963302612305
time(sec) => 0.01744699478149414
time(sec) => 0.0227658748626709
Run Code Online (Sandbox Code Playgroud)

莫名其妙地,将串联字符串分配给另一个变量会使过程变得越来越慢。

test_str = "abcdefghijklmn123456789"
str1 = ""
str2 = ""

start = time.time()
for i in range(1, 100001):

    str1 = str1 + …
Run Code Online (Sandbox Code Playgroud)

python big-o append string-concatenation

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

错误:找不到模块'pug'

这是我的index.js文件:

const express = require('express')
const app = express()

app.set('views', __dirname + '/views');
app.set('view engine', 'pug')

app.get('/', function (req, res) {
  res.render('index', { title: 'Hey', message: 'Hello there!' })
})


app.listen(3333, function () {
  console.log('Example app listening on port 3333!')
})
Run Code Online (Sandbox Code Playgroud)

index.pug文件:

html
  head
    title= title
  body
    h1= Hello
Run Code Online (Sandbox Code Playgroud)

package.json文件:

{
  "name": "@npm-private/pug_with_node",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": …
Run Code Online (Sandbox Code Playgroud)

node.js pugjs pug

12
推荐指数
4
解决办法
1万
查看次数

ReactJS"TypeError:无法读取未定义的属性'数组'"

运行此代码时,我在第一行遇到错误 App.propTypes

TypeError:无法读取未定义的属性"array"

码:

  class App extends React.Component {
   render() {
      return (
         <div>
            <h3>Array: {this.props.propArray}</h3>
            <h3>Array: {this.props.propBool ? "true" : "false"}</h3>
            <h3>Func: {this.props.propFunc(3)}</h3>
            <h3>Number: {this.props.propNumber}</h3>
            <h3>String: {this.props.propString}</h3>
            <h3>Object: {this.props.propObject.objectName1}</h3>
            <h3>Object: {this.props.propObject.objectName2}</h3>
            <h3>Object: {this.props.propObject.objectName3}</h3>
         </div>
      );
   }
}


App.propTypes = {
   propArray: React.PropTypes.array.isRequired, //I got error over here
   propBool: React.PropTypes.bool.isRequired,
   propFunc: React.PropTypes.func,
   propNumber: React.PropTypes.number,
   propString: React.PropTypes.string,
   propObject: React.PropTypes.object
}

App.defaultProps = {
   propArray: [1,2,3,4,5],
   propBool: true,
   propFunc: function(e){return e},
   propNumber: 1,
   propString: "String value...",

   propObject: {
      objectName1:"objectValue1",
      objectName2: "objectValue2",
      objectName3: …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs

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

类中的信号处理程序

我正在尝试使用信号 python模块编写一个类来处理信号.有一个类的原因是避免使用全局变量.这是我提出的代码,但不幸的是它不起作用:

import signal
import constants


class SignalHandler (object):
    def __init__(self):        
        self.counter = 0
        self.break = False
        self.vmeHandlerInstalled = False

    def setVmeHandler(self):        
        self.vmeBufferFile = open('/dev/vme_shared_memory0', 'rb')
        self.vmeHandlerInstalled = True

        signal.signal(signal.SIGUSR1, self.traceHandler)
        signal.siginterrupt(signal.SIGUSR1, False)
        #...some other stuff...


    def setBreakHandler(self):
        signal.signal(signal.SIGINT, self.newBreakHandler)
        signal.siginterrupt(signal.SIGINT, False)

    def newBreakHandler(self, signum, frame):        
        self.removeVMEHandler()
        self.break = True

    def traceHandler(self, signum, frame):
        self.counter += constants.Count        

    def removeVMEHandler(self):    
        if not self.vmeHandlerInstalled: return
        if self.vmeBufferFile is None: return

        signal.signal(signal.SIGUSR1, signal.SIG_DFL)

        self.vmeHandlerInstalled = False
Run Code Online (Sandbox Code Playgroud)

在主程序中,我以下列方式使用此类:

def run():
    sigHandler = SignalHandler() …
Run Code Online (Sandbox Code Playgroud)

python signals

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

如何使用 API 重命名 Gitlab 存储库名称

我在 GitLab 中创建了多个存储库。现在我想重命名或删除存储库。我怎样才能做到这一点?有可用的API吗?或者有没有可用的 git 命令?

git gitlab

8
推荐指数
2
解决办法
3万
查看次数

找不到模块googleapis

这是我的代码:

var http = require('http');
var express = require('express');
var Session = require('express-session');
var google = require('googleapis');
var plus = google.plus('v1');
var OAuth2 = google.auth.OAuth2;
Run Code Online (Sandbox Code Playgroud)

这是一个错误:

Error: Cannot find module 'googleapis'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/software/Harsh Patel/test/demo_auth/server.js:4:14)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
Run Code Online (Sandbox Code Playgroud)

我试图用这些方法重新安装模块

  1. npm install googleapis --save
  2. npm install googleapis
  3. npm install (将模块添加到package.json文件中)

但这些方法不起作用.

我在node_modules目录中找到了googleapis模块.

google-api google-authentication node.js

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

如何使用 GraphQL 处理 long Int?

如您所知,GraphQL 没有像 long int 这样的数据类型。因此,每当数字像 一样大时10000000000,它就会抛出这样的错误:Int cannot represent non 32-bit signed integer value: 1000000000000

为此,我知道两种解决方案:

  1. 使用标量。
import { GraphQLScalarType } from 'graphql';
import { makeExecutableSchema } from '@graphql-tools/schema';

const myCustomScalarType = new GraphQLScalarType({
  name: 'MyCustomScalar',
  description: 'Description of my custom scalar type',
  serialize(value) {
    let result;
    return result;
  },
  parseValue(value) {
    let result;
    return result;
  },
  parseLiteral(ast) {
    switch (ast.kind) {
    }
  }
});

const schemaString = `

scalar MyCustomScalar

type Foo {
  aField: MyCustomScalar
}

type …
Run Code Online (Sandbox Code Playgroud)

javascript bigint node.js graphql

6
推荐指数
2
解决办法
9798
查看次数