小编Fai*_*een的帖子

如何打开一个新窗口并使用jQuery将html插入其中?

我试图从javascript打开一个新窗口但没有插入到html中:

var callScriptText = $('#callScriptText').html();
var url = '/Action/CallScript/?callScript=';

// Open the current call script in a new window
var openWindow = window.open(url, 'callScriptPopup', 'width = 500, height = 500');
$(openWindow).html(callScriptText);
Run Code Online (Sandbox Code Playgroud)

有谁知道为什么?

html javascript jquery

66
推荐指数
3
解决办法
15万
查看次数

如何在新标签中打开剃须刀动作链接?

我试图让我的链接在新标签中打开(它必须是剃刀格式):

    <a href="@Url.Action("RunReport", "Performance", new { reportView = Model.ReportView.ToString() }, new { target = "_blank" })" type="submit" id="runReport" class="button Secondary">@Reports.RunReport</a>
Run Code Online (Sandbox Code Playgroud)

这不行.有人知道怎么做吗?

html c# razor

64
推荐指数
7
解决办法
10万
查看次数

为什么我的动画视图不能保留在React Native中的正确位置?

我创建了一个"圆形条"(一组视图),当图像移动时,它会从灰色切换到黄色.圆圈开始正确转换,但后来回到第一个点,而不是前往下一个圆点,以指示您在下一个图像上.无论如何,黄色圆圈总是会回到第一个位置.有谁知道为什么会发生这种情况?如何让它留在下一个位置?

请看这个由我制作的视频:https: //youtu.be/BCaSgNexPAs

以下是我创建和处理圆视图转换的方法:

    let circleArray = [];

    if (this.state.imgArray) {
        this.state.imgArray.forEach((val, i) => {
            const scrollCircleVal = this.imgXPos.interpolate({
                inputRange: [deviceWidth * (i - 1), deviceWidth * (i + 1)],
                outputRange: [-8, 8],
                extrapolate: 'clamp',
            });

            const thisCircle = (
                <View
                    key={'circle' + i}
                    style={[
                        styles.track,
                        {
                            width: 8,
                            height: 8,
                            marginLeft: i === 0 ? 0 : CIRCLE_SPACE,
                            borderRadius: 75

                        },
                    ]}
                >
                    <Animated.View
                        style={[
                            styles.circle,
                            {
                                width: 8,
                                height: 8,
                                borderRadius: 75,
                                transform: [
                                    {translateX: scrollCircleVal}, …
Run Code Online (Sandbox Code Playgroud)

reactjs react-router

11
推荐指数
1
解决办法
247
查看次数

如何在javascript中删除事件监听器?

我想知道如何添加一个事件监听器,你在jquery中使用on和off的方式?

document.removeEventListener('touchstart');
document.addEventListener('touchstart', function (e) {
     closePopupOnClick(e, popup);
});
Run Code Online (Sandbox Code Playgroud)

但这实际上并没有删除事件监听器.如果我将addEventListener代码放在一个函数中并将该函数传递给removeEventListener它将无法工作bc你不能将params传递给函数.有人知道怎么做吗?

javascript jquery touch

9
推荐指数
1
解决办法
8594
查看次数

为什么子组件没有从React Native中的父级接收更新值?

单击箭头时,"购物车项目视图"需要展开该特定视图并折叠当前展开的其他任何视图.该产品的item id将传递给父组件,以更新要扩展(活动)的视图.虽然id​​正在传递并在reducer中的expandedItem属性上设置,但是这不会更新到子组件(即使它作为子组件的prop传递).在最后重新评估子组件时,expandedViewItem仍为0,这是它的默认值.有谁知道如何让子组件接收更新的expandedItem值?它为什么还是0?

请观看我调试此问题的视频:https: //youtu.be/qEgxqAyWDpY

这是在子组件中评估值的位置:

render () {

const isExpanded = product.id === this.props.expandedViewId;
Run Code Online (Sandbox Code Playgroud)

这是整个子组件类:

export default class CartProductItem extends Component {
    constructor(props) {
        super(props);
        this.state = {showCounter: false};
    }

    expandCartProductItem(id) {
        this.props.onExpandClick(id); 
        this.setState(this.state);
    }

    updateDisplay = (nextProps) => {
        // Null check is needed here as 0 is a valid value
        if (nextProps.activeIndex !== null && nextProps.activeIndex === this.props.index) {
            this.setState({
                showCounter: !this.state.showCounter
            });
        } else if (nextProps.activeIndex !== null && nextProps.activeIndex !== this.props.index) { …
Run Code Online (Sandbox Code Playgroud)

reactjs react-native

7
推荐指数
1
解决办法
171
查看次数

ECMAScript 5在任何浏览器中都可用吗?

我想尝试一些新的ECMAScript 5功能.我想做一些类似于我在谷歌搜索时发现的一些代码的东西:

var obj = {};
Object.defineProperty( obj, "value", {
  value: true,
  writable: false,
  enumerable: true,
  configurable: true
});

(function(){
  var name = "John";

  Object.defineProperty( obj, "name", {
    get: function(){ return name; },
    set: function(value){ name = value; }
  });
})();

print( obj.value )
// true

print( obj.name );
// John

obj.name = "Ted";
print( obj.name );
// Ted
Run Code Online (Sandbox Code Playgroud)

这有可能吗?

javascript ecmascript-5

6
推荐指数
1
解决办法
150
查看次数

如何捕获 React Native 组件之外的所有点击?

我想弄清楚如何捕获所有点击事件以确定它们是否在我的 SearchBar 下拉菜单之外被点击。如果是这样,则下拉菜单将关闭。我有一种检测所有点击事件的方法(TouchableWithoutFeedback),但我无法找到一种方法来比较或确定它是否在我的组件之外。有人知道如何在 React Native 中做到这一点吗?

class Products extends Component {

    constructor(props) {
        super(props);

        this.hideSearchBar = this.hideSearchBar.bind(this);
    }

    hideSearchBar(e) {
        console.log('e: ', e.nativeEvent.target)
        // Determine if the click event was outside of the SearchBar component
    }

    render() {
        const {isLoading, products} = this.props.products;

        return (
            <TouchableWithoutFeedback onPress={(e) => this.hideSearchBar(e)} style={{zIndex: 0}}>
                <View style={styles.wrapper}>
                    <Header/>
                    <View style={styles.bodyWrapper}>
                        <ScrollView style={styles.scrollView}>
                            <ProductsContainer data={{productsList: { results: products }}}/>
                        </ScrollView>
                        <SearchBar ref={node => this.node = node} style={styles.searchBar}/>
                    </View>
                    <Footer/>
                </View>
            </TouchableWithoutFeedback>
        );
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-native

6
推荐指数
1
解决办法
3771
查看次数

如何为成功构建解决':react-native-vector-icons'错误?

我正在尝试构建我的react-native应用程序,但我收到一个错误:

  • 出了什么问题:配置项目':react-native-vector-icons'时出现问题.

  • 无法解析所有配置文件':react-native-vector-icons:classpath'.

  • 无法找到com.android.tools.build:gradle:2.3.+的任何匹配项,因为没有com.android.tools.build:gradle版本可用.

我尝试了以下命令:

  • npm安装
  • npm install npm -g
  • npm rm --cached
  • git clean -d -fx
  • npm cache clean --force
  • npm更新
  • npm升级
  • npm审核修复
  • npm install react-native-vector-icons --save

我已经尝试了一些我能找到的关于如何解决这个问题但我不能让这个错误消失.有谁知道如何解决这个react-native-vector-icons构建失败错误?

在此输入图像描述

reactjs react-native react-native-vector-icons

6
推荐指数
1
解决办法
850
查看次数

如何防止我的ImageBackground在React Native中调整大小?

当前,当您在登录页面上的文本字段内单击时,ImageBackground会调整大小或移动。我尝试将resizeMode设置为其所有可能的选项,但是它们都没有帮助。在不使用KeyboardAvoidingView的情况下如何防止这种情况发生?我尝试使用KeyboardAvoidingView,它不起作用,但也负面影响了我其他元素的宽度。

<ImageBackground source={require('../../assets/signinBG.jpg')} style={styles.backgroundImage}>
Run Code Online (Sandbox Code Playgroud)

样式:

backgroundImage: {
    flex: 1,
    backgroundColor:'rgba(0,0,0,0.45)',
    width: null,
    height: null
},
Run Code Online (Sandbox Code Playgroud)

这是我演示此行为的视频:

https://youtu.be/tVyq7mImecQ

react-native

5
推荐指数
1
解决办法
1154
查看次数

为什么在我的页面在React Native中转换之前有一个白色的"加载屏幕"?

我终于让我的页面过渡动画正常工作(它从屏幕的底部滑到顶部)但由于某种原因,在页面出现之前出现了一个空白的白色"加载屏幕",它破坏了整个点滑动动画!有人可以告诉我如何摆脱这个白色的屏幕?!

请看我制作的视频:https: //youtu.be/92XGji7L-RU

const { height: deviceHeight } = Dimensions.get('window');

class OrdersScreen extends Component {
    constructor(props) {
        super(props);

        this.state = {
            offset: new Animated.Value(deviceHeight),
        };
    }

    componentDidMount() {
        Animated.timing(this.state.offset, {
          duration: 350,
          toValue: 0,
        }).start();
    }

    closeModal() {
        Animated.timing(this.state.offset, {
          duration: 350,
          toValue: -deviceHeight,
        }).start(Actions.pop);
    }

    searchOrders = searchTerm => {
        this.props.dispatch(searchOrdersWithStatus(this.props.orderStatus, searchTerm))
    }

    render() {
        // default to Active Orders
        const status = this.props.orderStatus || ORDER_TYPE_DELIVERIES;
        let title = 'Order History';

        if (ORDER_TYPE_DELIVERIES == status) {
            title …
Run Code Online (Sandbox Code Playgroud)

reactjs react-native

5
推荐指数
1
解决办法
451
查看次数