我正在使用require.js和jQuery的当前稳定版本,我目前包括这样的jQuery
requirejs.config({
paths: {
'jQuery': 'vendor/jquery',
}
});
require(['jQuery'], function(jQuery) {
log(jQuery); // working
});
Run Code Online (Sandbox Code Playgroud)
我没有得到的是我真的不需要明确地回馈jQuery,因为它仍然可以工作(也在其他模块中):
require(['jQuery'], function( // nothing here ) {
log(jQuery); // working
});
Run Code Online (Sandbox Code Playgroud)
现在我不确定这是否是正确的方法,也因为使用$ dollar符号来引用jQuery不起作用!
我的文件结构是:
dist
css
style.css
index.html
js
bundle.js
src
css
style.css
index.html
js
main.js
node_modules
webpack.config.js
package.json
Run Code Online (Sandbox Code Playgroud)
我的webpack.config.js看起来像:
module.exports = {
entry: './src/js/main.js',
output: {
path: __dirname,
filename: './dist/js/bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules)/,
loader: 'babel',
query: {
presets: ['es2015']
}
},
{
test: /\.vue$/,
loader: 'vue'
}
]
}
};
Run Code Online (Sandbox Code Playgroud)
我跑:
webpack-dev-server --content-base dist --hot
Run Code Online (Sandbox Code Playgroud)
它构建并且看起来像是在工作.localhost:8080显示预期的结果,但热重载不起作用.当我更改文件时,我可以在终端中看到正在进行重建,但浏览器中没有任何反应.我在配置中遗漏了什么吗?
如果有可能做这样的话会很棒
$('input.specific-field').parsley('error', 'this is a custom error message');
Run Code Online (Sandbox Code Playgroud)
......但我想这是不可能的?
我怎么能得到这样的东西?
使用单文件架构我试图将数据(一个对象)从父组件传递给子组件:
App.vue
<template>
<div id="app">
<app-header app-content={{app_content}}></app-header>
</div>
</template>
<script>
import appHeader from './components/appHeader'
import {content} from './content/content.js'
export default {
components: {
appHeader
},
data: () => {
return {
app_content: content
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
appHeader.vue
<template>
<header id="header">
<h1>{{ app_content }}</h1>
</header>
</template>
<script>
export default {
data: () => {
return {
// nothing
}
},
props: ['app_content'],
created: () => {
console.log(app_content) // undefined
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
似乎是一项微不足道的任务,可能解决方案非常简单.谢谢你的建议:)
我需要始终显示标题和侧边栏索引,但让内容可以自由滚动x&y ...这个问题的任何解决方案?
我看过DataTables jQuery插件(例如:链接),但我想知道是否有其他选择.
我是论坛的新手,也是iOS Dev的新手.我遇到了UIWebView的问题,我不断失去对HTML表单的登录权限,该表单设置了一个phpsession cookie(过期设置为8h,适用于桌面).似乎UIWebView在大约一个小时左右之后抛弃了cookie,而不是8h.我已经阅读过NSHTTPCookieStorage应该自动关注cookie,即使应用程序进入后台模式或退出.
NSHTTPCookie看起来像这样
NSHTTPCookie版本:0名称:"PHPSESSID"值:"6f267fdc94c1ce5fcsdgg49b59a8f46b"expiresDate:2013-02-21 01:27:58 +0000创建时间:2001-01-01 00:00:01 +0000(1)sessionOnly:FALSE域: "mydomain.com"路径:"/"isSecure:FALSE
并且我确实将它保存在退出/睡眠中进入NSUserDefaults并在进入前台/打开应用程序时再次加载它,如下所示:如何设置我的网页视图已加载已登录用户-iPhone - 仍然,我一直在丢失登录.
任何人都能指出我的方向吗?非常感谢!
我目前正在这样做(根据下面的帖子):
NSURL *lastURL = [[self.webView request] mainDocumentURL];
if (lastURL.absoluteString == NULL) {
lastURL = [NSURL URLWithString:@"http://mydomain.com/"];
}
NSArray *cookiesForDomain = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:@"http://mydomain.com"]];
NSMutableURLRequest *newRequest = [NSMutableURLRequest requestWithURL:lastURL];
for (NSHTTPCookie *cookie in cookiesForDomain) {
NSString *cookieString = [NSString stringWithFormat:@"%@=%@", [cookie name], [cookie value]];
[newRequest setValue:cookieString forHTTPHeaderField:@"Cookie"];
NSLog(@"inserted cookie into request: %@", cookie);
}
[self.webView loadRequest:newRequest];
Run Code Online (Sandbox Code Playgroud) 在 Sapper 中,只有在客户端呈现时(使用onMount),我才尝试导入组件。有没有类似于 ReactSuspense和的 东西React.lazy?还是有另一种方法?
我需要在boxMesh上投射阴影,而网格本身应该是不可见的.
我已经在three.js GitHub问题跟踪器上找到了一种技术,它几年前似乎已经工作但现在已经不再工作了 - 它涉及创建一个新的着色器.
有没有其他方式或更新版本现在不再是工作技巧?
javascript ×5
jquery ×3
css ×2
html ×2
vue.js ×2
amd ×1
cookies ×1
ecmascript-6 ×1
ios ×1
node.js ×1
objective-c ×1
parsley.js ×1
requirejs ×1
sapper ×1
svelte ×1
three.js ×1
uiwebview ×1
webpack ×1
xcode ×1