在第1页上,我有一个带有onClick="window.location.href='Rendering.html?myVar1=3'"
的按钮
然后,我希望在第2页(myVar1
)个函数中使用Rendering.html
值。
在第2页中,我有:
var qs = new querystring();
var slideIndex = qs.get("myVar1")
showSlides(slideIndex);
但是,这似乎不起作用。
答案 0 :(得分:0)
看看这个答案:How can I get query string values in JavaScript?
我发现功能有用:
import React, { Component } from 'react'
import { Route, Switch } from "react-router-dom";
import Amplify, { Auth } from 'aws-amplify';
// import { AWS } from '@aws-amplify/core'; Following @Adam's comment.
import { DynamoDB } from 'aws-sdk';
import PropTypes from 'prop-types'
import '../../stylesheets/Dashboard.css'
export default class Dynamo extends Component {
constructor(props) {
super(props)
this.state = {}
}
componentDidMount() {
Amplify.configure({
Auth: {
identityPoolId: identityPoolId,
region: region,
userPoolId: userPoolId,
userPoolWebClientId: userPoolWebClientId,
},
});
var context = this;
Auth.currentCredentials().then(credentials => {
// Constructor for the global config.
console.log(credentials)
var dynamodb = new DynamoDB({
region: region,
credentials: credentials
});
...