小编Cha*_*ist的帖子

yii中view.php和_view.php之间的区别

yii中view.php和_view.php有什么区别?

我应该从_view使用或在Yii中查看?

通过render()或renderPartial(),我可以渲染两者?在性能或其他方面没有问题?

php yii

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

如何在YII中的CGridView中添加自定义列?

我需要在CGridView中添加一个列.

我用这个:

$this->widget('zii.widgets.grid.CGridView', array(
            'id'=>'user-grid',
            'dataProvider'=>$model->search(),
            'filter'=>$model,
            'pager' => array(
                'firstPageLabel' => '<<', 
                ),
            'columns'=>array(
                'username',
                'name',
                'email',
                'creationDate',
                array(
                        'class' => 'CButtonColumn',
                        'template' => '{change} {view}',
                        'buttons' => array(
                                        'change' => array(
                                                    'url'=> "'http://test.com/userservice/".$model->username."'",
                                        ),
                        ),

                ),
                array(
                    'name' => 'test',
                    'value' => 'testtest', 
                )
            ),
));
Run Code Online (Sandbox Code Playgroud)

但是我得到了错误:

属性"User.test"未定义.

yii

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

Twitter oAuth登录取消?

我在应用程序中使用Twitter登录.如果用户登录,它可以正常工作.我需要处理,当用户单击twitter oauth登录屏幕中的取消按钮而不是登录时.用户单击取消按钮时是否有回调机制?

twitter oauth twitter-oauth

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

使用jquery删除父li文本

我有这个HTML代码:

<div class="menu">
    <p class="menutext">
        <li class="pagenav">test
            <ul>
                <li class="page_item page-item-190 current_page_item">
                    <a href="http://test.com/">test2</a>
                </li>
            </ul>
        </li>
    </p>
</div> 
Run Code Online (Sandbox Code Playgroud)

我将删除test此行:

<li class="pagenav">test
Run Code Online (Sandbox Code Playgroud)

我怎么用jquery做到这一点?

jquery

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

如何设置与爷爷的相对位置!元素?

我有这样的布局:

<div class='one'>
   <div class='two'>
       <div class='three'>some text</div>
   </div>
</div>
Run Code Online (Sandbox Code Playgroud)

是否可以根据oneCSS 中的祖父元素 ( )设置三个的相对位置?

看看这个:http : //jsfiddle.net/chalist/H48Je/

html css css-position

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

网址短片网站如何运作?

像bit.ly或goo.gl这样的URL短缺网站如何运作?有谁知道他们使用什么技术或算法?

url short

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

多字符集替换问题

我有一个将英文数字字符更改为波斯语的功能:

  function en2fa(str){
    string = str.replace('1', '?');
    string = string.replace('2', '?');
    string = string.replace('3', '?');
    string = string.replace('4', '?');
    string = string.replace('5', '?');
    string = string.replace('6', '?');
    string = string.replace('7', '?');
    string = string.replace('8', '?');
    string = string.replace('9', '?');
    string = string.replace('0', '?');

    return string;
  }
Run Code Online (Sandbox Code Playgroud)

而且我想知道js将如何进行深入研究:

var a = '12345';
alert(en2fa(a.replace('1', '3')));
Run Code Online (Sandbox Code Playgroud)

我这样说:

32345

为什么?js如何解析这个文本?

============

编辑:我在功能代码中有错误.en2fa()编辑.

javascript text replace

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

“类型错误:无法读取未定义的属性 '$emit'” - VueJS

我正在尝试在 vuejs 中实现一个简单的身份验证。我有一个对象列表,其中包含真实的用户名和密码。我正在遍历这个列表并检查输入的用户名和密码。如果有匹配项,那么我将发出一个事件并更新我的经过身份验证的变量。但问题出在 forEarch 循环中的登录内部,我无法访问发射。

这是我的 Login.vue 文件

<template>
    <div id="login">
        <h1>Login</h1>
        <b-form-input v-model="input.username" placeholder="Username"></b-form-input>
        <br/>
        <b-form-input v-model="input.password" placeholder="Password" type="password"></b-form-input>
        <br/>
        <b-button variant="primary" v-on:click="login()">Submit</b-button>
    </div>
</template>

<script>
    
    export default {
        name: 'Login',
        data() {
            return {
                input: {
                    username: "",
                    password: ""
                }
            }
        },
        methods: {
            login() {
                var enteredUsername = this.input.username;
                var enteredPassword = this.input.password;
                if(enteredUsername !== "" && enteredPassword !== "") {
                    this.$parent.mockAccount.forEach(function (element) {
                        if (enteredUsername === element.username && enteredPassword === element.password) {
                            this.$emit("authenticated", true)
                            this.$router.replace({name: …
Run Code Online (Sandbox Code Playgroud)

javascript authentication vue.js

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

Javascript - 如何禁用鼠标滚轮1秒钟

我想禁用鼠标滚轮1秒钟.我怎么能这样做?

我有这个功能:

function clickOnMenu(id)
{

    switch(id)
    {
        case 1:
        $('.page').css('display','none');
        $('#first').click();
        rotateImage($('#first'));
        $('#menu div').removeClass('active');
        $('#first').addClass('active');
        break;

        case 2:
        $('.page').css('display','none');
        $('#feature').click();
        rotateImage($('#feature'));
        $('#feature').addClass('active');
        break;

        case 3:
        $('.page').css('display','none');
        $('#download').click();
        rotateImage($('#download'));
        $('#download').addClass('active');
        break;
    }
}
Run Code Online (Sandbox Code Playgroud)

这些情况用鼠标滚轮运行.我想在每个案例选中时,鼠标滚轮禁用1秒钟.

我怎么能这样做?

javascript jquery

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

为什么浏览器不会在其包中放置像jquery或extjs这样的重要javascript库?

为什么Web浏览器不会在其包中放置像jquery或extjs这样的重要javascript库?有了这个工作网站加载时间很短.

javascript browser

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

Python - 用另一个列表替换字符列表

我有两个清单:

wrong_chars = [
    ['?','?','?','?','?','?'],
    ['?','?','?','?','?','?'],
    ['?','?','?','?','?','?'],
    ['?','?','?','?','?','?'],
]

true_chars = [
    ['?'],
    ['?'],
    ['?'],
    ['?'],
]
Run Code Online (Sandbox Code Playgroud)

对于给定的字符串,我要替换的条目wrong_chars与那些在true_chars.在python中有一个干净的方法吗?

python string unicode

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