小编Mar*_*inh的帖子

如何在VueJs中添加动态属性

我正在使用vuejs,我想知道如何控制输入(必要时添加禁用属性).有没有办法在vuejs中添加动态属性?在我的Textfield组件下面:

    <template>
     <input type="text" placeholder="{{ placeholder }}" v-model="value">
    </template>
    <script>
    export default  {
      props: {
       disabled: {type: Boolean, default: false},
       placeholder: {type: String, default: ""},
       value: {twoWay: true, default: ""}
      }
     }
    </script>
Run Code Online (Sandbox Code Playgroud)

用法:

<textfield placeholder="Name" value.sync="el.name" :disabled="true"></textfield>
Run Code Online (Sandbox Code Playgroud)

javascript dynamic vue.js vue-component

35
推荐指数
3
解决办法
5万
查看次数

守夜人:检索新会话时发生错误

在我的反应项目中,我想使用夜视仪作为测试工具.我实际上在Windows上使用Nightwatch v1.0.4和selenium-server-standalone-3.9.1.jar.

这是我的配置(nightwatch.json):

{
  "src_folders": [
    "tests"
  ],
  "output_folder": "reports",
  "custom_commands_path": "",
  "custom_assertions_path": "",
  "page_objects_path": "",
  "globals_path": "",
  "disable_colors": false,
  "test_workers": false,
  "selenium": {
    "start_process": true,
    "host": "localhost",
    "port": 4444,
    "server_path": "./bin/selenium-server-standalone-3.9.1.jar",
    "log_path": "./logs",
    "cli_args": {
      "webdriver.chrome.driver": "./bin/chromedriver"
    }
  },
  "desiredCapabilities": {
    "browserName": "chrome",
    "acceptSslCerts": true
  },
  "test_settings": {
    "default": {
      "webdriver": {
        "server_path": "./bin/chromedriver",
        "cli_args": [
          "--log",
          "debug"
        ]
      },
      "disable_colors": false,
      "screenshots": {
        "enabled": false,
        "path": ""
      },
      "request_timeout_options": {
        "timeout": 60000,
        "retry_attempts": 5
      },
      "default_path_prefix" …
Run Code Online (Sandbox Code Playgroud)

javascript selenium selenium-chromedriver selenium-webdriver nightwatch.js

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

如何在nodejs中加密和解密字符串/对象

我想加密一个对象然后解密它。加密效果很好,但解密失败。下面是我的代码:

加密扩展.js

const crypto = require("crypto")
const password = "shared_key"
const algorithm = "aes256"

export const encrypt = (text) => {
    if(!text) return ''
    const cipher = crypto.createCipher(algorithm, password);
    let crypted = cipher.update(text, 'utf-8', 'base64');
    crypted += cipher.final('base64');
    return crypted;
}

export const decrypt = (text) => {
    if(!text) return ''
    const decipher = crypto.createDecipher(algorithm, password);
    let decrypted = decipher.update(text, 'base64', 'utf-8');
    decrypted += decipher.final('utf-8');
    return decrypted;
}
Run Code Online (Sandbox Code Playgroud)

在我的test.js中,我有:

import {encrypt, decrypt} from './crypto_ext.js'
let test = {key1: …
Run Code Online (Sandbox Code Playgroud)

encryption node.js cryptojs node-crypto

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

如何更改 vue-google-maps 中的标记图标

我是 vuejs 的新手。我正在使用vue-google-maps来显示标记,我想知道如何更改标记图标。我试图将图标添加到标记标签,但它不起作用。在我的代码下面:

在我的模板中,我有:

<marker :position.sync="m.position" :icon.sync="m.icon" v-for="m in markers"></marker>
Run Code Online (Sandbox Code Playgroud)

这是我的脚本:

export default {
 data: function data() {
  return {
   center: { lat: 33.533818415851705, lng: -3.746186887500016 },
   zoom: 7,
   markers: [{position: { lat: 34.263, lng: -6.582 }, icon:"../assets/marker-icon.png"}]
   };}};
Run Code Online (Sandbox Code Playgroud)

有人可以指导我吗?

javascript vue.js vue-component

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

为什么Twitter Typeahead不能与React js一起使用?

我目前在我的React项目中使用Twitter Typeahead,我想显示基于Typeahead的建议,但我无法使其工作.

在我的代码下面:

var Search = React.createClass({
    getInitialState: function () {
        return {query: ''};
    },
    handleChange: function (e) {
        this.setState({query: e.target.value});
    },
    componentDidMount(){
        var suggestions = {
            query: "d",
            results: [
                {name: "first"},
                {name: "second"},
                {name: "third"},
                {name: "fourth"}
            ]
        };


        var suggests = new Bloodhound({
            datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
            queryTokenizer: Bloodhound.tokenizers.whitespace,
            limit: 10,
            local: suggestions
        });

        var template = _.template('<span class="name"><%= name %></span>');

        $(React.findDOMNode(this.refs.suggestion)).typeahead({
                hint: true,
                highlight: true,
            },
            {
                name: 'suggests',
                displayKey: 'name',
                source: suggests.ttAdapter(),
                templates: {
                    suggestion: function (data) …
Run Code Online (Sandbox Code Playgroud)

javascript typeahead.js reactjs fluxible

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

如何在 vuejs 中转义内容?

我正在为我的 vuejs 项目(vuejs:版本 2)使用 webpack 模板。我想知道如何使我的内容转义(除了v-html):

请注意,message包含一些<a>标签,如 : These is my website <a href="https://google.com">link</a>

就像在车把中一样,我想使用类似的东西:

<p>{{{ message }}}</p><p>{{{ message | customFilter }}}</p>

我已经尝试了第一个选项,但它不起作用。有没有办法让它与三重胡须一起工作?

vue.js vue-component

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