我无法使用 React 加载本地视频。我已将视频放在我的文件夹“app/assets/video/concert.mp4”中。在我的 React 文件“search_bar.jsx”中,我有一个 HTML5 视频标签,我将视频来源为:
render(){
return (<video src="../../app/assets/videos/concert.mp4" controls />);
}
这是我的文件结构:
如果您加载外部视频,则视频标签有效。这是我的 webpack.config.js
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['react', 'es2015']
}
},
{
test: /\.html$/,
loader: 'html-loader?attrs[]=video:src'
}, {
test: /\.mp4$/,
loader: 'url?limit=10000&mimetype=video/mp4'
}
]
}
Run Code Online (Sandbox Code Playgroud) 我的教授目前正在教授动态记忆分配的主题以及指针.我不太明白以下示例:
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
int main(void)
{
int i;
char * names[7]; // declare array of pointers to char
char temp[16];
// read in 7 names and dynamically allocate storage for each
for (i = 0; i < 7; i++)
{
cout << "Enter a name => ";
cin >> temp;
names[i] = new char[strlen(temp) + 1];
// copy the name to the newly allocated address
strcpy(names[i],temp);
}
// print out the names
for …Run Code Online (Sandbox Code Playgroud)