watch 相关问题

Watch是指观察变量,文件或目录的状态,以执行某些或所有可能的操作,例如添加,删除或修改。

更改日期选择器 Swift UI 上的标签颜色

所以我想更改我的日期选择器(WheelDatePickerStyle)标签颜色,当前默认为绿色我想更改为黄色已经尝试了几个属性,如accentColor,但不起作用。 谢谢...

回答 1 投票 0

是否可以将 docker compose watch 与 Earthfile 创建的图像一起使用

所以我有这个简单的代码可以运行。 将streamlit导入为st st.title(“你好无聊”) 我使用命令 Earthly +all 使用简单的 Earthfile 创建此代码的 docker 映像 0.8版

回答 1 投票 0

在 VueJS 2 中观察路由对象

如何在 VueJS 2 上观察路由对象?这是我的代码 手表: { '$route.params.search': 函数(搜索) { 控制台.log(搜索) } } 这不起作用。 我尝试与 Deep 一起使用仍然不起作用...

回答 4 投票 0

我有 RBAC 问题,但我测试的一切似乎都正常?

这是此处描述的问题的延续(当我的角色似乎具有正确的权限时,如何修复基于角色的问题?) 我做了更多测试,但仍然不明白......

回答 1 投票 0

如何在 Vue 3 中观察 div 内的变化

如何观察 Vue 3 中 div 内的任何更改,例如类或文本更改。 从 我的文字 到: 我的 如何观察 Vue 3 中 div 内的任何更改,例如类或文本更改。 来自 <p class="font-bold">My text</p> 至: <p class="font-bold color-red">My updated text.</p> 我尝试过 Vue 3 Watch 方法,但 Watch 方法并不查找 div 内的更改。 watch(myDiv, (newValue, oldValue) => { // not working for changes inside a myDiv. }) 您可以使用您的段落创建一个 SFC 组件,并使用 onUpdated 钩子捕获每个更改 onUpdated(() => { console.log('updated'); }); 示例:https://stackblitz.com/edit/vue-5qtyjg 要观察一些属性,您需要先绑定它,例如<p :class="classes">{{ text }}</p>,也可以使用mutationObserver: const {ref, onMounted, onBeforeUnmount} = Vue const app = Vue.createApp({ data() { return { text: 'My text', classes: 'font-bold' }; }, watch: { text(newValue, oldValue) { console.log(newValue) }, classes(newValue, oldValue) { console.log(newValue) } }, methods: { addClass() { this.classes = 'font-bold color-red' } }, setup() { let observer = null let target = ref(null) let options = {subtree: true, childList: true, attributes: true} const callback = (mutationList, observer) => { for (const mutation of mutationList) { if (mutation.type === 'childList') { console.log('A child node has been added or removed.'); } else if (mutation.type === 'attributes') { console.log(`The ${mutation.attributeName} attribute was modified.`); } } }; onMounted(() => { target = document.querySelector(".mydiv") observer = new MutationObserver(callback); observer.observe(target, options); }); onBeforeUnmount(() => observer.disconnect()) }, }) app.mount('#demo') .color-red { color: red; } .font-bold { font-weight: 700; } <script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script> <div id="demo"> <p class="mydiv" :class="classes">{{ text }}</p> <input v-model="text" /> <button @click="addClass">class</button> </div> 在 Vue3 中,您可以在模板中使用 ref。 文档 <p ref="myDiv" class="test">{{text}}</p> 现在您可以在模板中定义它们。 myDiv.value 将保存 DOM 元素 const myDiv = ref(null) const text= computed(() => { if(myDiv.value.classList ... rest of your logic for checking classes) return "Text" else return "Updated Text" })

回答 3 投票 0

有没有比“手表制造”更聪明的替代方案?

我遇到了这个有用的提示,如果您经常处理文件并且希望它们自动构建,您可以运行: 手表品牌 每隔几秒钟它就会重新运行一次,一切都会构建完成。 然而...

回答 13 投票 0

在 redis 中进行事务处理时密钥会过期

我运行这样的命令: 删除字典 echo“日志:设置foo,过期1” hset 字典键栏 过期字典 1 多 hset dict key nowatchvalue 调试睡眠1 hget 字典键 执行 结果显示: (在...

回答 1 投票 0

是否可以在没有iPhone默认手表应用程序或Apple Watch本身的情况下为Apple Watch生成.watchface?

我想从我的 xcode 项目生成一个 .watchface 文件。有没有办法从默认手表应用程序外部创建 .watchface 文件? 我找到了一个 Facer 网站,他们在那里提供

回答 2 投票 0

尝试在 Vue 中观看对象时遇到两个错误

我目前正在 Vue 3 中创建一个应用程序来跟踪体育博彩表现。我有这个组件,它是输入投注单的各个部分的表单的一部分。每个子组件都会更新一个

回答 1 投票 0

如何将失败的同步从 G Shock 导入到 Strava?

G-Shock GBD-H1000 中记录的一些跑步已同步到 Move 应用程序,但无法进入 Strava。如何同步失败的运行?

回答 2 投票 0

为什么历史改变时watch不执行

从 '../components/InputChat.vue' 导入 InputChat 从 '../components/Chat.vue' 导入聊天 从“@/components/Layout.vue”导入布局; 从“@/</desc>导入侧边栏 <question vote="0"> <pre><code>&lt;script setup&gt; import InputChat from &#39;../components/InputChat.vue&#39; import Chat from &#39;../components/Chat.vue&#39; import Layout from &#34;@/components/Layout.vue&#34;; import Sidebar from &#34;@/components/Sidebar.vue&#34;; import ChatVue from &#39;@/components/Chat.vue&#39;; import { ChatManager } from &#39;../../lib/ChatManager&#39;; import { ref, watch } from &#39;vue&#39;; const manager = new ChatManager() const historys = ref(manager.historys) watch( historys ,(newHistory)=&gt;{ console.log(&#34;Watch execute&#34;); console.log(newHistory) console.log(historys.value); },{deep:true}) const handleSentMessage = (value)=&gt;{ console.log(value + &#34;Parent receive yet&#34;); manager.sentChat(value) } &lt;/script&gt; &lt;template&gt; &lt;Layout&gt; &lt;template #sidebar&gt; &lt;Sidebar /&gt; &lt;/template&gt; &lt;template #chat&gt; &lt;Chat :history=&#34;manager.history&#34;/&gt; &lt;/template&gt; &lt;template #input-chat&gt; &lt;InputChat @sent-message = &#34;handleSentMessage&#34;/&gt; &lt;/template&gt; &lt;/Layout&gt; &lt;/template&gt; </code></pre> <pre><code> export class ChatManager { constructor() { this.url = import.meta.env.VITE_API_URL || &#39;http://localhost:11434/api&#39; this.historys = []; } async sentChat(message){ const messageTemplate = { request:{ role:&#34;user&#34;, content: &#39;&#39; }, response:{ role:&#39;assistant&#39;, content:&#39;&#39; } } try { messageTemplate.request.content = message this.historys.push(messageTemplate) const response = await fetch(`${this.url}/chat`, { method: &#39;POST&#39;, headers: { &#39;Content-Type&#39;: &#39;application/json&#39; }, body: JSON.stringify({ model: &#34;llama2&#34;, messages: [ { role: &#34;user&#34;, content: message } ], stream: false }) }); const data = await response.json(); console.log(data) this.historys[this.historys.length-1].response.content = data.message.content this.historys[this.historys.length-1].response.role = data.message.role return data; } catch(error){ console.log(error); } } } </code></pre> <p>当历史记录更改时,为什么手表不执行我想要当历史记录更改时手表执行,但现在当历史记录更改时手表不执行,请帮助我</p> </question> <answer tick="false" vote="0"> <p>关于“Deep Watcher”的描述和使用可以参考vue3官方文档。</p> <p>使用“reactive”代替“ref”</p> </answer> </body></html>

回答 0 投票 0

开发工具不会关注 WSL2 中的更改

我正在使用应该重建/更新/等的开发工具。当源文件更改时,但在 Windows Subsystem for Linux (WSL2) 中运行该工具时不会发生这种情况。为什么,以及什么可以......

回答 1 投票 0

我的 [xyz] 开发工具不会监视 WSL2 中的更改

我正在使用应该重建/更新/等的开发工具。当源文件更改时,但在 Windows Subsystem for Linux (WSL2) 中运行该工具时不会发生这种情况。为什么,以及什么可以......

回答 1 投票 0

使用redis事务时需要新的客户端连接吗?

我的应用程序到处都使用redis的单例连接,它在启动时初始化。 我对 MULTI.EXEC() 的理解告诉我们,当 MULTI.EX...

回答 2 投票 0

不显示C#监视窗口值

VS2022 C# 监视窗口内部错误消息 我想咨询一下Watch窗口中无法计算数值的问题。 怎么解决这个问题?

回答 1 投票 0

观看 Vue.js 3 设置

我必须将当前的 Vue.js 代码更改为 Vue.js 3 代码,但我的 watch 属性有问题。 <script setup> 中 watch 的正确语法是什么? 当前代码: 观看...</desc> <question vote="4"> <p>我必须将当前的 Vue.js 代码更改为 Vue.js 3 <script setup> 代码,但我对 <pre><code>watch</code></pre> 属性有问题。 <pre><code>watch</code></pre> 中 <pre><code>&lt;script setup&gt;</code></pre> 的正确语法是什么?</p> <p>当前代码:</p> <pre><code> watch: { config: { handler(newConfig) { if (this.$refs &amp;&amp; this.$refs.range &amp;&amp; this.$refs.range.noUiSlider) { this.$refs.range.noUiSlider.destroy() const newSlider = this.noUiSliderInit(newConfig) return newSlider } }, deep: true, }, } </code></pre> <p>它在<pre><code>&lt;script setup&gt;</code></pre>中应该是什么样子?</p> </question> <answer tick="true" vote="9"> <p>vuejs 以其优秀的文档而闻名 - <a href="https://vuejs.org/guide/essentials/watchers.html#basic-example" rel="noreferrer">Watchers</a>(确保选择组合 API)</p> <p>基本上:</p> <pre><code>import {watch} from &#34;vue&#34;; // // // watch(config, (newConfig) =&gt; { // your code }, { deep: true }); </code></pre> <p>显然“您的代码”将与您当前拥有的不同,但我假设您只需要如何使用的帮助<pre><code>watch</code></pre></p> <p>即所有 <pre><code>this.*</code></pre> 在组合 API 中明显不同(你从不使用 <pre><code>this</code></pre>)</p> <p>值得注意的是 <em>当你直接在响应式对象上调用 watch() 时,它将隐式创建一个深度观察者 - 回调将在所有嵌套突变上触发:</em> <a href="https://vuejs.org/guide/essentials/watchers.html#deep-watchers" rel="noreferrer">深度观察者 </a></p> <p>所以,你甚至可能不需要 <pre><code>deep:true</code></pre> 选项 - 当然,问题中的代码片段这么小,很难说 <pre><code>config</code></pre> 是什么</p> </answer> <answer tick="false" vote="0"> <p>一开始<pre><code>import {watch} from &#39;vue&#39;</code></pre></p> <pre><code>import { ref, watch } from &#39;vue&#39;; export default { setup() { // Define a reactive reference to a value const count = ref(0); // Watch for changes to the count watch(count, (newValue, oldValue) =&gt; { console.log(`Count changed from ${oldValue} to ${newValue}`); }); // Update the count value const increment = () =&gt; { count.value++; }; return { count, increment }; } }; </code></pre> <p>我们定义一个 <pre><code>increment</code></pre> 函数来更新 <pre><code>count</code></pre> 值。每当 <pre><code>count</code></pre> 增加时,就会触发 <pre><code>watch</code></pre> 回调。</p> <h3>注意</h3> <p>您可以传递 <pre><code>deep</code></pre> 或 <pre><code>immediate</code></pre> 等选项来观察以更改 <pre><code>watch</code></pre> 功能的行为。</p> </answer> <answer tick="false" vote="-1"> <p>像这样尝试一下。</p> <pre><code>import { defineComponent } from &#34;vue&#34;; export default defineComponent({ data() { return { newSlider } }, watch: { config: { handler(newConfig) { if (this.$refs &amp;&amp; this.$refs.range &amp;&amp; this.$refs.range.noUiSlider) { this.$refs.range.noUiSlider.destroy() const newSlider = this.noUiSliderInit(newConfig) } }, deep: true, }, } }) </code></pre> </answer> </body></html>

回答 0 投票 0

java中如何查看多个目录

我想监控多个文件夹是否有新文件添加到文件夹中。 如果文件添加到文件夹中,我想获取文件的名称。 如何做到这一点。

回答 3 投票 0

在 vue 3 设置中观看

我必须将当前的 vue 代码更改为 vue3 代码,但我对 watch 属性有问题。 <script setup> 中 watch 的正确语法是什么? 当前代码: 手表: { 会议...</desc> <question vote="4"> <p>我必须将当前的 <pre><code>vue</code></pre> 代码更改为 <pre><code>vue3 &lt;script setup&gt;</code></pre> 代码,但我对 <pre><code>watch</code></pre> 属性有问题。 <pre><code>watch</code></pre> 中 <pre><code>&lt;script setup&gt;</code></pre> 的正确语法是什么?</p> <p>当前代码:</p> <pre><code> watch: { config: { handler(newConfig) { if (this.$refs &amp;&amp; this.$refs.range &amp;&amp; this.$refs.range.noUiSlider) { this.$refs.range.noUiSlider.destroy() const newSlider = this.noUiSliderInit(newConfig) return newSlider } }, deep: true, }, } </code></pre> <p>它在 <pre><code>&lt;script setup&gt;</code></pre> 中应该是什么样子?</p> </question> <answer tick="true" vote="9"> <p>vuejs 以其优秀的文档而闻名 - <a href="https://vuejs.org/guide/essentials/watchers.html#basic-example" rel="noreferrer">Watchers</a>(确保选择组合 API)</p> <p>基本上:</p> <pre><code>import {watch} from &#34;vue&#34;; // // // watch(config, (newConfig) =&gt; { // your code }, { deep: true }); </code></pre> <p>显然“您的代码”将与您当前拥有的不同,但我假设您只需要如何使用的帮助<pre><code>watch</code></pre></p> <p>即所有 <pre><code>this.*</code></pre> 在组合 API 中明显不同(你从不使用 <pre><code>this</code></pre>)</p> <p>值得注意的是 <em>当你直接在响应式对象上调用 watch() 时,它将隐式创建一个深度观察者 - 回调将在所有嵌套突变上触发:</em> <a href="https://vuejs.org/guide/essentials/watchers.html#deep-watchers" rel="noreferrer">深度观察者 </a></p> <p>所以,你甚至可能不需要 <pre><code>deep:true</code></pre> 选项 - 当然,问题中的代码片段这么小,很难说 <pre><code>config</code></pre> 是什么</p> </answer> <answer tick="false" vote="0"> <p>以下是如何在 Vue 3 组件的 <pre><code>watch</code></pre> 函数中使用 <pre><code>setup</code></pre> 函数:</p> <pre><code>import { ref, watch } from &#39;vue&#39;; export default { setup() { // Define a reactive reference to a value const count = ref(0); // Watch for changes to the count watch(count, (newValue, oldValue) =&gt; { console.log(`Count changed from ${oldValue} to ${newValue}`); }); // Update the count value const increment = () =&gt; { count.value++; }; return { count, increment }; } }; </code></pre> <p>我们定义一个 <pre><code>increment</code></pre> 函数来更新 <pre><code>count</code></pre> 值。每当 <pre><code>count</code></pre> 增加时,就会触发 <pre><code>watch</code></pre> 回调。</p> <h3>注意</h3> <p>您还可以通过将依赖项数组传递给 <pre><code>watch</code></pre> 函数来监视多个值的更改。此外,您可以指定 <pre><code>deep</code></pre> 或 <pre><code>immediate</code></pre> 等选项来自定义观察者的行为。</p> </answer> <answer tick="false" vote="-2"> <p>像这样尝试一下。</p> <pre><code>import { defineComponent } from &#34;vue&#34;; export default defineComponent({ data() { return { newSlider } }, watch: { config: { handler(newConfig) { if (this.$refs &amp;&amp; this.$refs.range &amp;&amp; this.$refs.range.noUiSlider) { this.$refs.range.noUiSlider.destroy() const newSlider = this.noUiSliderInit(newConfig) } }, deep: true, }, } }) </code></pre> </answer> </body></html>

回答 0 投票 0

Junit Testwatcher 跳过/忽略测试

我创建了一个 TestWatcher,它应该在 TestCase 失败、成功或被跳过时执行某些操作。 成功和失败的方法都会被触发,但两者都没有 @覆盖 受保护的 void 已跳过(

回答 2 投票 0

需要帮助解决观看频道 tokio 中的错误

使用 std::mem::{self, ManuallyDrop}; /// 单生产者多消费者 #[东京::主要] 异步 fn main() { 使用 tokio::sync::watch; 使用 tokio::time::{持续时间,睡眠}; 让 (tx, _rx) = wa...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.