小编Tel*_*per的帖子

无法使用.attr()设置href

编辑:这是与扩展程序Adblock Plus相关的仅限Firefox的问题.重新安装插件结束了这种奇怪的行为,其中具有一些特定特殊字符的URL会使锚点完全消失.

如何使用jQuery将具有特殊字符的URL归因于href?

我现在正在做的是:

var x = encodeURI(myURLhere)
Run Code Online (Sandbox Code Playgroud)

我知道它生成有效的链接,因为我一直在使用console.log(x)它来检查它.

但当我这样做时:

$("#tweet").attr("href", x);
Run Code Online (Sandbox Code Playgroud)

我的锚只是消失了.

发生这种情况的URL的一个示例:

https://twitter.com/intent/tweet?text=%22If%20it%20is%20not%20right%20do%20not%20do%20it;%20if%20it%20is%20not%20true%20do%20not%20say%20it.%22%20%E2%80%93%20Marcus%20Aurelius
Run Code Online (Sandbox Code Playgroud)

有没有人有任何建议,我可以做什么来将这些URL归因于我的主播的href?

html javascript jquery

3
推荐指数
1
解决办法
85
查看次数

使用离子芯4时不会显示离子含量

我正在开发一个使用Vue.js和Ionic的应用程序,但是我不知道为什么更新Ionic核心版本会破坏ion-content标签,我尝试使用Google搜索来检查该标签是否已停用,但似乎没有确实如此。

为了说明,我举了一个使用离子芯的例子。使用最新的Ionic版本,不会显示ion-content标签,但是如果切换到旧的Ionic版本,则显示就很好。

<head>
    <meta charset="UTF-8">
    <title>Ionic Test</title>
    <script src="https://unpkg.com/@ionic/core@latest/dist/ionic.js"></script>
    <!-- <script src="https://unpkg.com/@ionic/core@0.0.2-30/dist/ionic.js"></script> -->
</head>
<body>
    <ion-app>
        <ion-page>
        <ion-header>
            <ion-toolbar>
            <ion-title>Example</ion-title>
            </ion-toolbar>
        </ion-header>
        <ion-content class="content" padding>
            <ion-list>
                </ion-item>
                    <ion-label full>I'm an example text...</ion-label>
                    <ion-button>Example button</ion-button>
                </ion-item>
            </ion-list>
        </ion-content>
        </ion-page>
    </ion-app>
</body>
Run Code Online (Sandbox Code Playgroud)

这是此代码的jsFiddle:https ://jsfiddle.net/telmo/chk9h080/

有人可以告诉我这里发生了什么吗?

ionic-framework ionic4

2
推荐指数
1
解决办法
1019
查看次数

哪些条件会触发“read_line”后跟“expect”的错误处理?

当使用 读取输入流时read_line(),如果您不遵循带有 a 的语句,.expect()编译器会警告您this `Result` may be an `Err` variant, which should be handled

我想了解的是什么样的情况会触发这样的错误处理。

我尝试将我的程序通过管道传输到另一个程序(./my_program | echo "hello")中,这样我就没有机会输入任何输入,并且应该能够看到正在执行的错误处理。令我惊讶的是,它实际上导致了恐慌状态:

thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', src/libstd/io/stdio.rs:792:9

在《The Rust 编程语言》一书中的这段代码中,我们指定了一个字符串,我认为当程序无法读取输入流时应该打印该字符串:

use std::io;

fn main() {
    println!("Guess the number!");

    println!("Please input your guess.");

    let mut guess = String::new();

    io::stdin().read_line(&mut guess)
        .expect("Failed to read line");

    println!("You guessed: {}", guess);
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能真正看到这种行为的实际效果?

rust

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

标签 统计

html ×1

ionic-framework ×1

ionic4 ×1

javascript ×1

jquery ×1

rust ×1