我正在尝试从UIAlertController获取textField值,但每当我尝试输入值并尝试将其打印出来时,输出都不会显示任何内容.
码:
var alert = UIAlertController(title: "Enter the password", message: "Message", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.Default, handler: nil))
alert.addTextFieldWithConfigurationHandler({(textField: UITextField!) in
textField.placeholder = "Enter text:"
textField.secureTextEntry = true
println(textField.text)
})
self.presentViewController(alert, animated: true, completion: nil
Run Code Online (Sandbox Code Playgroud) 我是React和Redux的新手,仍然有点困惑。
我的目标是使用GET请求在HTML中呈现一堆json数据。我正在使用react和redux来管理对象的状态,但是我相信我的问题是数据甚至不存在
因此,基本上,每当有人请求URL / courses时,他/她都将在json中看到大量数据。
我在组件中收到错误
TypeError:无法读取未定义的属性“ map”
这是代码
行动
export function getCourses() {
return (dispatch) => {
return fetch('/courses', {
method: 'get',
headers: { 'Content-Type', 'application/json' },
}).then((response) => {
if (response.ok) {
return response.json().then((json) => {
dispatch({
type: 'GET_COURSES',
courses: json.courses
});
})
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
减速器
export default function course(state={}, action) {
switch (action.type) {
case 'GET_COURSES':
return Object.assign({}, state, {
courses: action.courses
})
default:
return state;
}
}
Run Code Online (Sandbox Code Playgroud)
零件
import React from 'react';
import { …Run Code Online (Sandbox Code Playgroud) 我使用algolia在我的网站上进行搜索,但我意识到了一件事.我使用搜索框生成器来自定义我的搜索输入字段.但是当我尝试在我的搜索输入字段上应用autocomplete.js时会出现问题.最初,它看起来像下面的那个,

但是当我应用自动完成功能时,它看起来像这样
代码 - HTML
<form id="search" novalidate="novalidate" onsubmit="return false;" class="searchbox sbx-google" style="margin-top: 7px;">
<div role="search" class="sbx-google__wrapper">
<input type="search" id="search_input" name="search" placeholder="Search" autocomplete="off" required="required" class="sbx-google__input">
<button type="submit" title="Submit your search query." class="sbx-google__submit">
<svg role="img" aria-label="Search">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#sbx-icon-search-13"></use>
</svg>
</button>
<button type="reset" title="Clear the search query." class="sbx-google__reset">
<svg role="img" aria-label="Reset">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#sbx-icon-clear-3"></use>
</svg>
</button>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
代码 - JAVASCRIPT
autocomplete('#search_input',
{ hint: false }, {
source: autocomplete.sources.hits(index, {hitsPerPage: 5}),
//value to be displayed in input control after …Run Code Online (Sandbox Code Playgroud) 我想将单元格附件类型设置为我自己的自定义图像
let cell = tableView.cellForRow(at: indexPath)
cell?.accessoryType = UIImage(named: "heart.pdf")
Run Code Online (Sandbox Code Playgroud)
我该如何在 Swift 中做到这一点?
问候
我想从10倒数到0
我使用普通的javascript在线找到了解决方案,但可以说我想在Vue中实现。jQuery中的解决方案
<template>
{{ countDown }}
</template>
<script>
export default {
computed: {
countDown() {
// How do i do the simple countdown here?
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
如何在Vue.js中重新创建相同的功能?
谢谢
我的目标是建立像Snapchat这样的功能,从现在起24小时后我发布的内容将被删除.我想创建一个API,用于检查当前时间是否已超过24小时,如果超过,则将删除它,它将检查创建的时间和当前时间,并将在这两个时间之间进行比较.
我用时间将日期/时间存储到数据库.假设我的数据库代码如下所示
var mongoose = require('mongoose');
var moment = require('moment');
var ItemPost = new Schema({
name: String,
created: { type: Date, default: moment() },
timeLeft: { type: Number, default: 24 },
});
Run Code Online (Sandbox Code Playgroud)
例如,如果我现在发布内容
11:31 PM 8 Jan 2017
Run Code Online (Sandbox Code Playgroud)
假设现在的时间是上述时间.比方说9个小时过去了,现在的时间是
08:31 PM 9 Jan 2017
Run Code Online (Sandbox Code Playgroud)
如何在创建日期后24小时内获得时间差异?
我的尝试
function checkTime(item) {
var currentTime = moment();
// assume item is an ItemPost object from the database
var timeStore = item.created()
// Im stuck here, I tried various codes. But nothing has worked so …Run Code Online (Sandbox Code Playgroud) 如何将IBDesignable自定义类连接到UIButton?
码
import UIKit
@IBDesignable class MyButton: UIView {
@IBInspectable var borderColor: UIColor = UIColor.clear {
didSet {
layer.borderColor = borderColor.cgColor
}
}
@IBInspectable var borderWidth: CGFloat = 0 {
didSet {
layer.borderWidth = borderWidth
}
}
@IBInspectable var cornerRadius: CGFloat = 0 {
didSet {
layer.cornerRadius = cornerRadius
}
}
}
Run Code Online (Sandbox Code Playgroud)
该文件的名称是 MyButton.swift
它没有将MyButton显示为类?我该如何解决这个问题?
我的目标是以编程方式将UIViewController呈现为弹出窗口。
如您所见,过渡样式设置为Cross Dissolve,演示文稿设置为Over current context。因此,从技术上讲,如果我单击该按钮,过渡将起作用,我的目标是以编程方式进行操作。
func clickButton() {
//What should I do here?
}
Run Code Online (Sandbox Code Playgroud)
如何以编程方式显示弹出窗口clickButton?
我的目标很简单,将p标签粘贴到自定义css卡的右侧,使其粘贴到左侧非常简单。
custom-text {
margin-left: 30px;
}
Run Code Online (Sandbox Code Playgroud)
问题是我如何使这100美元始终坚持正确?并假设美元的价值变为5美元,如何使其始终在右边?
我可以用
custom-text-right {
margin-left: 450px;
}
Run Code Online (Sandbox Code Playgroud)
但是此解决方案无法扩展到其他值(我只是使用引导程序来提供信息)
HTML部分:
<h4>Price: <span class="dollar">$3.15</span></h4>
Run Code Online (Sandbox Code Playgroud) 我已经设定了我的$GOPATH=$HOME/go和$GOROOT=usr/local/go
我试着按照本教程,以便在golang webserver上进行热重新加载
https://github.com/codegangsta/gin
我通过安装它
go get github.com/codegangsta/gin
Run Code Online (Sandbox Code Playgroud)
然后我试着跑
gin -h
Run Code Online (Sandbox Code Playgroud)
它显示找不到命令
我已经检查过我的库安装了库 $GOPATH/bin
我该怎么办?
我想使用 Golang 作为服务器,使用 Nuxt 作为前端,我在谷歌上搜索,但找不到任何示例。
我在 nuxt + express 中发现的 express/node.js 代码。链接在下面
const express = require('express')
// Create express instnace
const app = express()
// Require API routes
const users = require('./routes/users')
// Import API Routes
app.use(users)
// Export the server middleware
module.exports = {
path: '/api',
handler: app
}
Run Code Online (Sandbox Code Playgroud)
我可以创建 golang 服务器 api 并将其部署为微服务,但是我会失去 nuxt 的 SSR 功能吗?如果我使用单独的服务器而不是 nuxt + node.js 的整体版本,那么谷歌仍然会抓取我的网页
链接:https : //github.com/nuxt-community/express-template
问候