我正在使用shift + alt + f它来对代码进行排序vscode,但为什么我会收到此错误:?
错误:
[eslint] There should be no space after '{' (babel/object-curly-spacing)
Run Code Online (Sandbox Code Playgroud)
代码:
User.findOne({ _id: temp }, (obj) => {
Run Code Online (Sandbox Code Playgroud)
删除 _id 之前和 temp 之后的空格后,我没有任何错误,但我应该如何修复 vscode 中的自动排列?
如何Signup通过反应原生来检查按钮中的Firebase auth中是否存在用户?
这是我的登录页面代码:
export default class Login extends Component {
constructor(props) {
super(props)
this.state = {
email: '',
password: '',
response: ''
}
this.signUp = this.signUp.bind(this)
this.login = this.login.bind(this)
}
async signUp() {
try {
await firebase.auth().createUserWithEmailAndPassword(this.state.email, this.state.password)
this.setState({
response: 'Account Created!'
})
setTimeout(() => {
this.props.navigator.push({
id: 'App'
})
}, 500)
} catch (error) {
this.setState({
response: error.toString()
})
}
}
async login() {
try {
await firebase.auth().signInWithEmailAndPassword(this.state.email, this.state.password)
this.setState({
response: 'user login in'
})
setTimeout(() => …Run Code Online (Sandbox Code Playgroud) 我在中有3 View个ScrollView,如何View在Scroll Down上向右或向左淡入淡出?
<ScrollView >
<View>
<Text>Fade Right View 1</Text>
</View>
<View>
<Text>Fade Right View 2</Text>
</View>
<View>
<Text>Fade Right View 3</Text>
</View>
</ScrollView >
Run Code Online (Sandbox Code Playgroud)
像这样:元素淡入滚动(https://codepen.io/annalarson/pen/GesqK)
我正在使用此功能通过node.js发送照片,但这不起作用。 telegram-bot-api https://www.npmjs.com/package/telegram-bot-api
var telegram = require('telegram-bot-api');
var api = new telegram({
token: '<PUT YOUR TOKEN HERE>',
});
api.sendPhoto({
chat_id: <YOUR CHAT ID>,
caption: 'This is my test image',
// you can also send file_id here as string (as described in telegram bot api documentation)
photo: '/path/to/file/test.jpg'
})
.then(function(data)
{
console.log(util.inspect(data, false, null));
});
Run Code Online (Sandbox Code Playgroud)
但是我有这个错误
fn = function () { throw arg; };
^
StatusCodeError: 403 - [object Object]
Run Code Online (Sandbox Code Playgroud) Telegeram Bot msg.chat.id和之间的区别是什么msg.from.id?显然,两者都是相同的并且返回用户ID.
bot.sendMessage(msg.chat.id, 'Hi', opts)
Run Code Online (Sandbox Code Playgroud)
和
bot.sendMessage(msg.from.id, 'Hi', opts)
Run Code Online (Sandbox Code Playgroud) 如何通过电报机器人获取用户位置纬度和经度?
模块:链接
代码:
bot.onText(/getLocation/, (msg) => {
const opts = {
reply_markup: JSON.stringify({
keyboard: [
[{text: 'Location', request_location: true}],
[{text: 'Contact', request_contact: true}],
],
resize_keyboard: true,
one_time_keyboard: true,
}),
};
bot.sendMessage(msg.chat.id, 'Contact and Location request', opts);
});
Run Code Online (Sandbox Code Playgroud) 我想播放音频文件,但是它正在自动播放,我不能暂停播放。
我该如何解决?我的代码
开始时必须暂停
:
import Video from 'react-native-video';
export default class Android extends Component {
constructor(props) {
super(props)
this.state = {
paused: true,
}
}
video: Video;
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
</Text>
<Video
ref={(ref: Video) => { this.video = ref }}
source={{ uri: "http://s3.picofile.com/d/7376893331/8b7bc5b4-4b5e-47c4-96dd-b0c13fd18157/Sara_Diba_Delbare_Man.mp3", mainVer: 1, patchVer: 0 }}
paused={this.state.paused} …Run Code Online (Sandbox Code Playgroud) 我解析此JSON数组和我想利用type对象,并提出,在新列type2,这是一个排的我JSON行,我获取的foreach(提供)由于新线的JSON无效参数在某些行。我该如何解决?
这不是奥奇
[{"id":"26","answer":[{"option":"4","text":"Hello
"}],"type":"3"}]
Run Code Online (Sandbox Code Playgroud)
这个是奥基
[{"id":"26","answer":[{"option":"4","text":"Hello"}],"type":"3"}]
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
<?php
$con=mysqli_connect("localhost","root","","array");
mysqli_set_charset($con,"utf8");
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="SELECT `survey_answers`,us_id FROM `user_survey_start`";
if ($result=mysqli_query($con,$sql)){
while ($row = mysqli_fetch_row($result)){
$json = $row[0];
if(!is_null($json)){
$jason_array = json_decode($json,true);
// type2
$type = array();
foreach ($jason_array as $data) {
if (array_key_exists('type', $data)) {
// Now we will only use it if it actually exists
$type[] = $data['type'];
}
}
// lets …Run Code Online (Sandbox Code Playgroud) 为什么我有这个错误:
TypeError: node_telegram_bot_api_1.default is not a constructor
这是我的 TypeScript 代码:
import * as dotenv from 'dotenv';
dotenv.config({ path: __dirname + '/.env'})
console.log('Hello TypeScript')
import TelegramBot from 'node-telegram-bot-api';
const bot = new TelegramBot(process.env.BOT_TOKEN, {polling: true});
Run Code Online (Sandbox Code Playgroud)
这是我编译后的输出代码:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const dotenv = require("dotenv");
dotenv.config({ path: __dirname + '/.env' });
console.log('Hello TypeScript');
const node_telegram_bot_api_1 = require("node-telegram-bot-api");
const bot = new node_telegram_bot_api_1.default(process.env.BOT_TOKEN, { polling: true });
Run Code Online (Sandbox Code Playgroud)
React Native 中如何解决这个问题?我使用此命令:
react-native link用于链接react-native-vector-icons
我的错误:
rnpm-install ERR! Something went wrong while linking. Error: Expected "/* Begin ", "/* End ", "\"", or [A-Za-z0-9_.] but "<" found.
Please file an issue here: https://github.com/facebook/react-native/issues
Expected "/* Begin ", "/* End ", "\"", or [A-Za-z0-9_.] but "<" found.
Run Code Online (Sandbox Code Playgroud) 我想将数字编码为字符。
码:
const CryptoJS = require('crypto-js');
function msg() {
return '7543275'; // I want to encrypt this number to character
}
const msgLocal = msg();
// Encrypt
const ciphertext = CryptoJS.AES.encrypt(msgLocal, 'password');
// Decrypt
const bytes = CryptoJS.AES.decrypt(ciphertext.toString(), 'password');
const plaintext = bytes.toString(CryptoJS.enc.Utf8);
console.log(plaintext);
Run Code Online (Sandbox Code Playgroud) javascript ×7
react-native ×4
telegram-bot ×4
node.js ×2
base64 ×1
cryptojs ×1
encryption ×1
eslint ×1
firebase ×1
java ×1
json ×1
mysql ×1
php ×1
reactjs ×1
telegram ×1
typescript ×1