使用RequireJS设置smooch-js(Setup smooch-js with RequireJS)
这是我失败的最小代码:
<!doctype html><html> <head> <meta charset="utf-8"> <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script> <script> require.config({ "paths": { "smooch": "https://cdn.smooch.io/smooch.min" } }); // Tried this require(["require", "smooch"], function(require){ var Smooch = require("smooch"); console.log(Smooch); // → undefined }); // Tried that require(["smooch"], function(Smooch){ console.log(Smooch); // → undefined }); </script> </head> <body></body> </html>
require
给我一个undefined
所以没有Smooch.init(...)
给我。 在Firefox和Chrome中都进行了测试。难道我做错了什么 ?
I followed Smooch instructions with no success.
Here is the minimal code that fails for me:
<!doctype html><html> <head> <meta charset="utf-8"> <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js"></script> <script> require.config({ "paths": { "smooch": "https://cdn.smooch.io/smooch.min" } }); // Tried this require(["require", "smooch"], function(require){ var Smooch = require("smooch"); console.log(Smooch); // → undefined }); // Tried that require(["smooch"], function(Smooch){ console.log(Smooch); // → undefined }); </script> </head> <body></body> </html>
require
returns me anundefined
so noSmooch.init(...)
for me. Tested in both Firefox and Chrome.Am I doing something wrong ?
原文:https://stackoverflow.com/questions/36796682
更新时间:2022-06-21 06:06
最满意答案
您将使用子查询:
SELECT SUM(population) FROM (SELECT population FROM city WHERE CountryCode = 'NOR' ORDER BY population DESC LIMIT 3 ) cp
You would use a subquery:
SELECT SUM(population) FROM (SELECT population FROM city WHERE CountryCode = 'NOR' ORDER BY population DESC LIMIT 3 ) cp
相关问答
更多-
函数结果总和(Sum of Function Results)[2023-10-02]
您的数据集看起来像是SSRS中的矩阵。 所以在这种情况下使用SUM(C*R) =SUM(Fields!C.Value*Fields!R.Value) Your dataset looks like it is a matrix in the the SSRS. So in that case use SUM(C*R) =SUM(Fields!C.Value*Fields!R.Value) -
总结MySQL中的前5个值(Sum top 5 values in MySQL)[2023-07-06]
尝试这个: SELECT driver, SUM(`position`) FROM (SELECT driver, race, season, `position`, IF(@lastDriver=(@lastDriver:=driver), @auto:=@auto+1, @auto:=1) indx FROM results, (SELECT @lastDriver:=0, @auto:=1) A ORDER BY driver, `positio ... -
尝试使用NOT EXISTS() : SELECT s.* FROM ( SELECT strftime('%W', date(p.match_date, 'unixepoch', 'localtime')) AS week_number, sum(red_cards + yellow_cards) AS cards, user_id FROM user_records GROUP BY week_number, user_id) s WHERE ...
-
您需要一个不同的键功能进行排序: def by_veg_sum(record): return sum(record[entry] for entry in ['Cucumber','Carrot','Runner Bean']) 并在您的代码中使用它: sorted_data = sorted(data, key=by_veg_sum, reverse=True) 您可以添加调试打印到查看计算的总和: def by_veg_sum(record): s = sum(record[ent ...
-
我会试着先用这种方式将数字与数字分开: >>> df_new = df2['Symbol'].apply(lambda x: pd.Series(re.split('(\d*)',x)[:2])) >>> df_new.columns=['Symbol', 'Symbol_i'] >>> df_new Symbol Symbol_i 0 X 1 1 X 2 2 Y 1 3 Y 2 4 Z ...
-
您可以使用子查询和LIMIT关键字来完成。 使用LIMIT ,如果它们具有相同的记录时间,您将不会错过任何条目。 SQL SELECT r.CID, r.EID, c.date, (SELECT p.name FROM REGISTER rr JOIN PLAYER p on rr.PID = p.PID WHERE rr.CID = r.CID and rr.EID = r.EID ...
-
根据错误,看起来您正在使用SQL Server。 你需要在括号中包装@Sum : SELECT TOP (@Sum) * FROM Customer Based on the error, it looks like you’re using SQL Server. You need to wrap the @Sum in parenthesis: SELECT TOP (@Sum) * FROM Customer
-
如何总结最佳结果?(How to sum top results?)[2023-12-31]
您将使用子查询: SELECT SUM(population) FROM (SELECT population FROM city WHERE CountryCode = 'NOR' ORDER BY population DESC LIMIT 3 ) cp You would use a subquery: SELECT SUM(population) FROM (SELECT population FROM city ... -
来自4个以上表格的前3个结果(Top 3 results from 4+ tables)[2023-06-17]
如果您需要或想要保留不同的表,请使用union: select sum(score) from ((select score from event_id_1_results_table where player_id = 1) union (select score from event_id_2_results_table where player_id = 1) union (select score from event_id_3_results ... -
distinct on select distinct on (first_name, last_name) * from records where report_date <= '2017-02-19 15:00:00' and report_date >='2017-02-19 10:00:00' and score is not null order by first_name, last_name, report_date desc distinct on select dis ...