js |
JavaScriptタグが付けられた新着投稿 - Qiita |
2次元配列を1次元配列にする方法 |
https://qiita.com/shuhei_m/items/1888b378139898138e56
|
react |
2022-09-18 01:12:42 |
海外TECH |
MakeUseOf |
How to Create a Human Resource Plan |
https://www.makeuseof.com/how-to-create-a-human-resource-plan/
|
candidates |
2022-09-17 16:30:14 |
海外TECH |
MakeUseOf |
9 Ways to Open the Apps & Features Tool in Windows 11 |
https://www.makeuseof.com/9-ways-to-open-the-apps-features-tool-in-windows-11/
|
windows |
2022-09-17 16:15:13 |
海外TECH |
DEV Community |
Vue 3 tips/tricks I guarantee you didn't know |
https://dev.to/the_one/vue-3-tipstricks-i-guarantee-you-didnt-know-49ml
|
Vue tips tricks I guarantee you didn x t knowVNode hooksDebugging hooksExpose slots from a child componentScoped styles and multi root nodes don t work well togetherBe careful when using CSS selectorsBoolean castingTemplate refs with v for order is not guaranteed VNode hooks On each component or HTML tags we can use some special undocumented hooks as event listeners The hooks are onVnodeBeforeMount onVnodeMounted onVnodeBeforeUpdate onVnodeUpdated onVnodeBeforeUnmount onVnodeUnmountedI mainly use onVnodeMounted on components when I need to execute some code when the component is mounted or onVnodeUpdated to debug when something is updated but I am quite sure all of them can come in handy in some cases Example lt script setup gt import ref from vue const count ref function onMyComponentMounted function divThatDisplaysCountWasUpdated lt script gt lt template gt lt MyComponent vnodeMounted onMyComponentMounted gt lt div vnodeUpdated divThatDisplaysCountWasUpdated gt count lt div gt lt template gt It should be noted that these hooks pass some arguments to the callback function They pass only one argument which is the current VNode except for onVnodeBeforeUpdate and onVnodeUpdated that pass two arguments the current VNode and the previous VNode Debugging hooks We all know the lifecycle hooks that Vue provides us But did you know that Vue gives us two hooks that we can use for debugging purposes They are onRenderTrackedonRenderTriggeredonRenderTracked gets called for every reactive dependency that has been tracked lt script setup gt import ref onRenderTracked from vue const count ref const count ref It will be called twice once for count and once for countonRenderTracked event gt console log event lt script gt onRenderTriggered gets called when we trigger a reactivity update or as the docs say it when a reactive dependency triggers the component s render effect to be re run lt script setup gt import ref onRenderTriggered from vue const count ref It will be called when we update countonRenderTriggered event gt debugger lt script gt Expose slots from a child component If you use a third party component chances are that you wrap the implementation of it in your own wrapper component This is a good practice and scalable solution but in that way the slots of that third party component are getting lost and we should find a way to expose them to the parent component WrapperComponent vue lt template gt lt div class wrapper of third party component gt lt ThirdPartyComponent v bind attrs gt lt Expose the slots of the third party component gt lt template v for name in slots name slotData gt lt slot name name v bind slotData gt lt slot gt lt template gt lt ThirdPartyComponent gt lt div gt lt template gt Now every component that uses WrapperComponent can use the slots of ThirdPartyComponent Scoped styles and multi root nodes don t work well together In Vue we can finally have more than one root node components That is great but personally I fall into a design limitation when doing that Imagine we have a child component lt template gt lt p class my p gt First p lt p gt lt p class my p gt Second p lt p gt lt template gt And a parent component lt template gt lt h gt My awesome component lt h gt lt MyChildComponent gt lt template gt lt style scoped gt There is no way to style the p tags of MyChildComponent my p color red deep my p color red lt style gt There is no way from the scoped styling of the multi root parent component to style the child component s p tags So in short a multi root component can t target multi root child component s styles with scoped styles The best way to fix that would be to wrap the parent or child component or both so we have only one root element But if you absolutely need both to have multi root nodes you can Use a non scoped style lt style gt my p color red lt style gt Use CSS Modules lt template gt lt h gt My awesome component lt h gt lt MyChildComponent class style trick gt lt template gt lt style module gt trick color red lt style gt Since we are specifying a class here then the multi root child component has to explicitly specify the attribute fallthrough behavior If you want my opinion unless you absolutely need a multi root node component go with a single root node and don t deal with this design limitation at all Be careful when using CSS selectors main nav gt li will be many times slower compared to my li color red From the docs Due to the way browsers render various CSS selectors p color red will be many times slower when scoped i e when combined with an attribute selector If you use classes or ids instead such as in example color red then you virtually eliminate that performance hit I highly recommend you to read Efficiently Rendering CSS if you want to dive deeper into this topic Boolean casting In Vue or early versions of Vue for props with Boolean types we had different behavior depending on the order st case props hoverColor String Boolean lt defaults to nd case props hoverColor Boolean String lt defaults to false Not only that but if you pass the prop like this lt my component hover color gt lt my component gt In the first case it would be an empty string In the second case it would be true As you can see this was a bit confusing and inconsistent Fortunately in Vue we have a new behavior that is consistent and predictable Boolean behavior will apply regardless of type appearance order So hoverColor String Boolean lt defaults to falsehoverColor Boolean String lt defaults to falsehoverColor Boolean Number lt defaults to false Template refs with v for Order is not guaranteed remember this one so you don t lose hours of debugging trying to figure out what is going onIn the code below lt script setup gt import ref from vue const list ref const itemRefs ref lt script gt lt template gt lt ul gt lt li v for item in list ref itemRefs key item gt item lt li gt lt ul gt lt template gt we are looping over the list array and we create the itemRefs array itemRefs is not guaranteed to have the same order as list array If you want to find out more about this you can read this issue Ending the articleI do have more tips and tricks but this article became long already Expect another article in the near future with even better tips tricks Thank you all for reading any feedback is highly appreciated Know a cool company hiring Vue js developers Also I am looking for a new job so if you know a cool company that is hiring a Senior Vue js developer please reach out to rolanddoda gmail com |
2022-09-17 16:08:11 |
Apple |
AppleInsider - Frontpage News |
iPhone 14 Pro review: The best power & camera to cost balance |
https://appleinsider.com/articles/22/09/17/iphone-14-pro-review-the-best-power-camera-to-cost-balance?utm_medium=rss
|
iPhone Pro review The best power amp camera to cost balanceThe iPhone Pro adds an always on display MP camera and a new user interface paradigm to an already outstanding smartphone line ーbut the already excellent iPhone Pro looms large Dynamic Island on iPhone ProApple s annual refresh of its flagship smartphone saw the debut of the iPhone Pro the smaller of the two Pro level smartphones for As usual Apple brings several changes to the product line including quite a few frequently rumored and much needed additions Read more |
2022-09-17 16:57:12 |
Apple |
AppleInsider - Frontpage News |
U.S. antitrust officials ask to be heard in Epic vs. Apple appeal |
https://appleinsider.com/articles/22/09/16/us-antitrust-officials-ask-to-be-heard-in-epic-vs-apple-appeal?utm_medium=rss
|
U S antitrust officials ask to be heard in Epic vs Apple appealThe US Department of Justice has requested to participate in the appeals hearing regarding Epic s case against Apple s App Store policies Apple and Epic Games are heading back to court in October with each party appealing against aspects of the antitrust rulings of a previous lawsuit Now officials from the U S Department of Justice are asking to take part in the oral arguments according to court documents seen by Reuters Read more |
2022-09-17 16:59:08 |
海外TECH |
Engadget |
Justice Department officials want to take part in Epic v. Apple appeal |
https://www.engadget.com/department-of-justice-epic-v-apple-filing-165153120.html?src=rss
|
Justice Department officials want to take part in Epic v Apple appealThe Department of Justice has asked a US federal judge to participate in the upcoming appeals case between Epic and Apple according to court documents seen by Reuters The companies will return to court next month to argue over the outcome of their antitrust case The Justice Department filed a brief to enter the case at the start of the year The agency said it was concerned that Judge Yvonne Gonzalez Rogers had improperly interpreted US antitrust law In reports surfaced that the DOJ was preparing to launch a probe of Apple s business practices A decision to uphold the company s win over Epic could limit the DOJ s ability to sue it for antitrust violations quot The United States believes that its participation at oral argument would be helpful to the court especially in explaining how the errors in antitrust law interpretation could significantly harm antitrust enforcement beyond the specific context of this case quot the Justice Department wrote on Friday The agency has asked for minutes of the court s time Neither side is against the Justice Department s involvement though Apple has requested that the DOJ s argument time count against Epic s total time allotment or that the court extends the proceedings |
2022-09-17 16:51:53 |
ニュース |
BBC News - Home |
Queen's funeral will be a 'deeply personal event' - Dean of Westminster |
https://www.bbc.co.uk/news/uk-62942184?at_medium=RSS&at_campaign=KARANGA
|
westminster |
2022-09-17 16:27:12 |
ニュース |
BBC News - Home |
Prince Harry to stand vigil at Queen's coffin in military uniform |
https://www.bbc.co.uk/news/uk-62938463?at_medium=RSS&at_campaign=KARANGA
|
request |
2022-09-17 16:23:28 |
ニュース |
BBC News - Home |
Newcastle United 1-1 Bournemouth: Alexander Isak cancels out Philip Billing opener |
https://www.bbc.co.uk/sport/football/62859267?at_medium=RSS&at_campaign=KARANGA
|
Newcastle United Bournemouth Alexander Isak cancels out Philip Billing openerAlexander Isak scores his first goal at St James Park but Newcastle remain without a win since the opening day of the season after being held by Bournemouth |
2022-09-17 16:09:41 |
ニュース |
BBC News - Home |
Rangers 2-1 Dundee Utd: Antonio Colak scores twice as Ibrox side earn victory |
https://www.bbc.co.uk/sport/football/62859193?at_medium=RSS&at_campaign=KARANGA
|
Rangers Dundee Utd Antonio Colak scores twice as Ibrox side earn victoryAntonio Colak scores twice as Rangers end a three game losing streak with a narrow win at home to bottom of the league Dundee United |
2022-09-17 16:02:10 |
ニュース |
BBC News - Home |
Premiership: Harlequins 27-30 Saracens - Sarries win dramatic derby |
https://www.bbc.co.uk/sport/rugby-union/62927697?at_medium=RSS&at_campaign=KARANGA
|
stoop |
2022-09-17 16:37:40 |
ニュース |
BBC News - Home |
Queen's lying-in-state: How long is the queue? |
https://www.bbc.co.uk/news/uk-62872323?at_medium=RSS&at_campaign=KARANGA
|
thames |
2022-09-17 16:04:35 |
北海道 |
北海道新聞 |
コンサドーレ 18日に敵地で横浜M戦 |
https://www.hokkaido-np.co.jp/article/732857/
|
試合 |
2022-09-18 01:15:00 |
北海道 |
北海道新聞 |
<支部予選から>主軸、3打点で貢献 北照・松田 |
https://www.hokkaido-np.co.jp/article/732855/
|
貢献 |
2022-09-18 01:05:00 |
北海道 |
北海道新聞 |
デジタル活用し連携強化 日中韓ASEAN経済相 |
https://www.hokkaido-np.co.jp/article/732856/
|
asean |
2022-09-18 01:05:00 |
北海道 |
北海道新聞 |
<支部予選から>初登板で1失点好投 北見柏陽・石田 |
https://www.hokkaido-np.co.jp/article/732854/
|
北見緑陵 |
2022-09-18 01:01:00 |
コメント
コメントを投稿