请参考vue.js数据但没有

时间:2017-08-24 13:52:04

标签: javascript vue.js

1.我是vue.js的初学者,但当我尝试一些例子时,我发现了一些不常见的东西。第一个是我在id中设置body,并按照以下方式编写我的js代码:

<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="./css/semantic.css">
    <script type="text/javascript" src="js/vue.js">
    </script>
    <title></title>
</head>
<body style="background-color:black;" id="app">
<div class="ui container" style="margin:20px;">
    <div class="ui segment">
        <h1>{{ title }}</h1>
        <p>
            {{ message }}
        </p>
    </div>
</div>

<script>
    var app = new Vue({
        el: "#app",
        data: {
            message: "Hello, world!",
            title: "How about you?"
        }
    })
</script>

</body>
</html>

这是我的结果,没有向我显示数据: (I leave out the comments area code)

2.第二个问题是当我在数据中创建一个对象时,我将其引用如下,它在div标签中也不起作用。 这是代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="./css/semantic.css">
    <script type="text/javascript" src="js/vue.js">
    </script>
    <title></title>
</head>
<body style="background-color:black;">
<div class="ui container" style="margin:20px;">
    <div class="ui segment" id="app">
        <h1>{{ article.title }}</h1>
        <p>
            {{ article.message }}
        </p>
    </div>

</div>

<script>
    var app = new Vue({
        el: "#app",
        data: {
            article{
                message: "Hello, world!",
                title: "How about you?"
            }
        }
    })
</script>

</body>
</html>

所以我想知道在使用semanticUI和vue.js时是否存在一些冲突?

1 个答案:

答案 0 :(得分:1)

作为最佳做法,您可以创建顶级$word=$_POST['word']; $word3 = $_POST['word']; $word = explode(";", $word); $noOfWords = count($word); $word2 = $word3; if($noOfWords == 1){ $searchString = " word_eng LIKE '".$word3."%'"; } else { $searchString = $whereClause = ""; foreach($word as $word){ $searchString .= " OR word_eng LIKE '".$word."'"; echo $word; } } $whereClause = ($searchString != "") ? " WHERE ".preg_replace('/OR/', '', $searchString, 1) : $whereClause; $sql = "SELECT word_eng FROM words ".$whereClause ." LIMIT 17 "; ,如下所示:

&#13;
&#13;
div#app
&#13;
var app = new Vue({
    el: "#app",
    data: {
        message: "Hello, world!",
        title: "How about you?"
    }
})
&#13;
&#13;
&#13;