翡翠问题,意外特征# [英] Problems with Jade, Unexpected character #
本文介绍了翡翠问题,意外特征#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直得到: ... / views / index.jade:20 18 |警报(错误)19 | })> 20 | server.on('warning',function(warning){21 | alert(warning)22 |})23 | var num = -1意外的字符#expected'','\\ n',',','!'或'='
这是我的玉文件:
extends layout
block content
#splash(style='z-index: 3120; position: absolute; left:0; top:0; width:100%; min-height:100%; background-color:#444;')
img(src="/stylesheets/some.png", style='display:block; margin-left: auto; margin-right: auto; margin-top:10%;')
div.row
#welcome
div.row
#joined.small-6.columns
#finished.small-6.columns
script
$(document).ready(function(){
var server = io.connect()
$.fn.exists = function(){return this.length>0}
var userName = "none"
server.on('error',function(error){
alert(error)
})
server.on('warning',function(warning){
alert(warning)
})
var num = -1
server.on('welcome', function(data){
userName = data.name
num = data.num
$("#splash").delay(2000)
.queue(function(n){
$(this).fadeOut(1000, function () {
$(this).remove()
$("#welcome").html("Welcome "+data.name)
$("#welcome").fadeIn(1000)
$("#welcome").delay(2000)
.queue(function(n){
$(this).fadeOut(1000, function () {
$(this).remove()
})
n()
})
})
n()
})
})
server.on('joined', function(name){
num += 1
$("#joined").append("<p>"+name+" joined</p>")
$("#joined p").last().delay(1000)
.queue(function(n){
$(this).fadeOut(1000, function (){
$(this).remove()
})
n()
})
})
server.on('finished', function(name){
num -= 1
$("#finished").append("<p>"+name+" logged out</p>")
$("#finished p").last().delay(1000)
.queue(function(n) {
$(this).fadeOut(1000, function () {
$(this).remove()
})
n()
})
})
})
我做错了什么?我弄清楚了。这曾经用于早期版本。该版本还允许编写正常的javascript。
What am I doing wrong? I cant figure it out. This used to work with an earlier version. That version also allowed to write normal javascript.
推荐答案
jade github readme.md :
jade github readme.md:
Jade版本0.31.0已弃用隐式文本仅支持脚本和样式。要解决这个问题,您需要做的就是添加一个。脚本或样式标记后的字符。
并且jade docs :
And jade docs:
通常,您可能需要标记中的大块文本。内联脚本或样式就是一个很好的例子。要做到这一点,只需添加一个。标签后(没有前面的空格)
写脚本。
而不是脚本
这篇关于翡翠问题,意外特征#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文