我正在使用react-native-sound模块但是当我启动声音并按下Home按钮退出应用程序时,声音仍然在播放.
当我重新加载应用程序时,它会再次启动声音并且我无法使用.stop()它来销毁它,因为它只会破坏加载到第一个上面的第二个.
我该怎么办呢?
class Home extends Component {
constructor(props) {
super(props);
this.props.actions.fetchScores();
}
componentWillReceiveProps(nextProps){
nextProps.music.backgroundMusic.stop()
setInterval( () => {
nextProps.music.backgroundMusic.play()
nextProps.music.backgroundMusic.setNumberOfLoops(-1)
}, 1000);
}
}
export default connect(store => ({
music: store.music
})
)(Home);
Run Code Online (Sandbox Code Playgroud) 我正在尝试用数据填充mat-table,但出现错误:尝试这样做时,找不到ID为“ id”的列。
这是我在组件文件中完成的方式:
export class ListAllTrucksComponent {
displayedColumns: string[] = ['id', 'plate', 'status', 'type'];
orders: Order[] = [];
dataSource: MatTableDataSource<Order>;
constructor(private orderService: OrderService) {
orderService.getAll().subscribe((orders) => {
for (const order of orders) {
const newOrder = new Order(order[0], order[1], order[2], order[3]);
this.orders.push(newOrder);
}
console.log(this.orders);
this.dataSource = new MatTableDataSource<Order>(this.orders);
});
}
applyFilter(filterValue: string) {
this.dataSource.filter = filterValue.trim().toLowerCase();
}
}
Run Code Online (Sandbox Code Playgroud)
这是我从示例中基本上复制的html:
<main>
<div id="content">
<mat-form-field>
<input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
</mat-form-field>
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<!-- Position Column -->
<ng-container matColumnDef="position">
<th mat-header-cell …Run Code Online (Sandbox Code Playgroud) 我在堆栈上尝试了很多不同的答案,但没有一个有效。我正在尝试将存储库添加为包含另一个子模块的子模块。所以我做的是这样的:
git submodule add -b develop git@github.com:submoduleRepo
Run Code Online (Sandbox Code Playgroud)
子模块将添加到存储库中,并在其中包含子模块的文件夹。但是该文件夹是空的。所以我跟进这个命令:
git submodule update --init --recursive
Run Code Online (Sandbox Code Playgroud)
这没有给我带来任何回报。如果我进入子模块的目录cd submoduleRepo,然后输入 git submodule,我会得到:
fatal: no submodule mapping found in .gitmodules for path 'src/app/nestedSubmoduleRepo'
Run Code Online (Sandbox Code Playgroud)
这是我的主存储库的 .gitmodules:
[submodule "submoduleRepo"]
path = submoduleRepo
url = git@github.com:submoduleRepo.git
branch = develop
Run Code Online (Sandbox Code Playgroud)
在 submoduleRepo/.gitmodules 中:
[submodule ".\\src\\app\\nestedSubmoduleRepo"]
path = .\\src\\app\\nestedSubmoduleRepo
url = git@github.com:nestedSubmoduleRepo.git
Run Code Online (Sandbox Code Playgroud)
为什么我不断收到此错误并且目录未填充?
编辑:
一旦我运行--init --recursive一次,它就会给我错误:
fatal: No url found for submodule path 'submoduleRepo/src/app/nestedSubmoduleRepo' in .gitmodules
Failed to recurse into submodule path 'submoduleRepo'
Run Code Online (Sandbox Code Playgroud)
我的git配置:
[core]
repositoryformatversion = …Run Code Online (Sandbox Code Playgroud) 我收到此错误:
在非对象上调用成员函数query().
此外,当我使用其他MySQLi函数时,它给了我相同的错误,但对于该功能.
我的connection.php:
<?php
$mysqli = new mysqli("localhost","user","pass","db");
if(mysqli_connect_errno()){
trigger_error('Connection failed: '.$mysqli->error);
}
?>
Run Code Online (Sandbox Code Playgroud)
我的功能:
function form_year($find, $value, $from, $vehicletype){
//Query setup
$autoquery = "SELECT
Year,
Vehicle,
Brand,
Model,
Type,
FROM
vehicle_tbl
WHERE
Vehicle = '".$vehicletype."'
GROUP BY
Year";
$autoresult = $mysqli->query($autoquery);
$search = array("%value%", "%options%");
$rows = file_get_contents("tpl/options.html");
while($row = $autoresult->fetch_assoc()){
$replace = array($row[$value], $row[$value]);
$tr .= str_replace($search, $replace, $rows);
}
return str_replace($find, $tr, $from);
}
Run Code Online (Sandbox Code Playgroud)
函数和连接包含在调用函数的位置
是否可以在jQuery中使用AND选择器?我试图过滤结果,我需要多个选择器为真.这是我使用的,而不是"或"所以","我使用我想使用"和".
$('div.job:not([data-province="'+province+'"])', 'div.job:not([data-employment="'+employment+'"])', 'div.job:not([data-education="'+education+'"])', 'div.job:not([data-branch="'+branch+'"])').fadeOut('slow');
Run Code Online (Sandbox Code Playgroud) 我想制作一个按钮,它的底部有一个图标和一个标签,如下所示:

什么是最好的方法来做到这一点?是否可以将图像视图对象和标签拖到按钮中?
当我尝试在touchablehighlight onpress中设置状态时,我的应用程序崩溃了.这就是我得到的:
<TouchableHighlight onPress={this.setState({toggleCharacter: false})}>
<Image style={styles.tekstballon} source={tekstballon} />
</TouchableHighlight>
Run Code Online (Sandbox Code Playgroud)
我的最终目标是切换toggleCharacter,如果它是假的我想把它设置为真,如果它是真的我想把它设置为假,但我不知道如何.
什么是将此代码转换为jquery的最佳方法?我试过这种方式,但注意到Internet Explorer给我带来了麻烦.所以我决定用jQuery做,但我看到很多方法,但我不知道如何用它来做同样的功能.
function updateField(str, id, prevvalue, value, vehicletype) {
if (str == "") {
document.getElementById(id).innerHTML = "";
return;
}
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById(id).innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "inc/form_rest.php?q=" + str + "&prevvalue=" + prevvalue + "&value=" + value + "&vehicletype=" …Run Code Online (Sandbox Code Playgroud) 我刚刚迁移到 Angular 8,然后开始收到错误
Module '"../../node_modules/@angular/router/router"' has no exported member 'NoPreloading'.
Run Code Online (Sandbox Code Playgroud)
该错误来自以下行:
import { NoPreloading, RouterModule, Routes } from '@angular/router';
Run Code Online (Sandbox Code Playgroud)
它发生在 的所有成员身上@angular/router。我究竟做错了什么?尽管出现错误,一切仍然正常。
当我console.log()在onEnd视频组件的功能内部时,它会在页面加载时立即被调用.该console.log()从onPress的ThouchableHighlight也被称为在同一时间.我使用Actions.videoPlayer()repo react-native-router-flux来点击此视频的缩略图进入此页面.
render() {
let video = require('../videos/HISTORISCHETUIN.mp4');
return (
<View>
<TouchableHighlight onPress={console.log("Test")}>
<View>
<Video source={video} // Can be a URL or a local file.
ref={ref => this.player = ref} // Store reference
rate={1.0} // 0 is paused, 1 is normal.
volume={1.0} // 0 is muted, 1 is normal.
muted={false} // Mutes the audio entirely.
paused={true} // Pauses playback entirely.
resizeMode="stretch" // Fill the whole screen at …Run Code Online (Sandbox Code Playgroud)