小编Art*_*nov的帖子

Computed 在 Vue 3 脚本设置中如何工作?

我正在努力去computed工作<script setup>

<template>
  <div>
    <p>{{ whatever.get() }}</p>
  </div>
</template>


<script setup>
import {computed} from "vue";

const whatever = computed({
    get() {
        console.log('check')
        return 'check?';
    }
})
</script>
Run Code Online (Sandbox Code Playgroud)

该语句console.log()通过了,但return似乎抛出了一个错误:

check
Vue warn]: Unhandled error during execution of render function 
  at <Cms>
Uncaught TypeError: $setup.whatever.get is not a function
at Proxy.render (app.js?id=d9e007128724c77a8d69ec76c6c081a0:39550:266)
at renderComponentRoot (app.js?id=d9e007128724c77a8d69ec76c6c081a0:25902:44)
at ReactiveEffect.componentUpdateFn [as fn] (app.js?id=d9e007128724c77a8d69ec76c6c081a0:30019:57)
at ReactiveEffect.run (app.js?id=d9e007128724c77a8d69ec76c6c081a0:23830:29)
at setupRenderEffect (app.js?id=d9e007128724c77a8d69ec76c6c081a0:30145:9)
at mountComponent (app.js?id=d9e007128724c77a8d69ec76c6c081a0:29928:9)
at processComponent (app.js?id=d9e007128724c77a8d69ec76c6c081a0:29886:17)
at patch …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vuejs3 vue-composition-api vue-script-setup

35
推荐指数
1
解决办法
7万
查看次数

如何从 Vue 3 中的内部脚本设置导出默认值?

导出默认语句似乎在内部不起作用<script setup>

如果我尝试将其导出为test.vue

<template>
  <div id="test" class="test">

  </div>
</template>


<script setup>
const x = 5

export default {
    x
}
</script>


<style scoped lang="scss">
</style>
Run Code Online (Sandbox Code Playgroud)

然后将其导入另一个blog.vue

<script setup>
import x from './test'
</script>
Run Code Online (Sandbox Code Playgroud)

我收到大量错误:

app.js?id=3b6365f542826af47b926162803b3ef6:37396 Uncaught Error: Module build failed (from ./node_modules/vue-loader/dist/index.js):
TypeError: Cannot read properties of null (reading 'content')
    at selectBlock (:3000/Users/artur/PhpstormProjects/safa-ameedee.com/node_modules/vue-loader/dist/select.js:23:45)
    at Object.loader (:3000/Users/artur/PhpstormProjects/safa-ameedee.com/node_modules/vue-loader/dist/index.js:67:41)
    at Object../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/vue/backend/components/test.vue?vue&type=script&setup=true&lang=js (app.js?id=3b6365f542826af47b926162803b3ef6:37396:7)
    at __webpack_require__ (app.js?id=3b6365f542826af47b926162803b3ef6:64806:42)
    at Module../resources/vue/backend/components/test.vue?vue&type=script&setup=true&lang=js (app.js?id=3b6365f542826af47b926162803b3ef6:60116:217)
    at __webpack_require__ (app.js?id=3b6365f542826af47b926162803b3ef6:64806:42)
    at Module../resources/vue/backend/components/test.vue (app.js?id=3b6365f542826af47b926162803b3ef6:59477:102)
    at __webpack_require__ (app.js?id=3b6365f542826af47b926162803b3ef6:64806:42) …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vuejs3 vue-script-setup

16
推荐指数
1
解决办法
4万
查看次数

如何在 Nuxt 3 中使用 useQuery() 作为 API 路由参数?

我正在遵循一个指南,其中api routes构建如下:

1 创建server/api/route.js文件:

export default defineEventHandler((event) => {

    return {
        message: `hello api route`
    }
})
Run Code Online (Sandbox Code Playgroud)

2 在组件中使用 api 路由,如下所示:

<script setup>
const { data: message } = await useFetch('/api/route')
</script>

<template>
  <div>
    <p>api data {{ message }}</p>
  </div>
</template>
Run Code Online (Sandbox Code Playgroud)

这有效,但是当我尝试添加query parameterin时1.

export default defineEventHandler((event) => {

    const { name } = useQuery(event)

    return {
        message: `hello api name parameter ${name}`
    }
})
Run Code Online (Sandbox Code Playgroud)

并在组件中调用它2.

<script setup>
const { data: …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js nuxt.js nuxtjs3

13
推荐指数
2
解决办法
9689
查看次数

CUDA GPU 处理:TypeError: compile_kernel() 得到一个意外的关键字参数“boundscheck”

今天我开始使用 CUDA 和 GPU 处理。我找到了这个教程:https : //www.geeksforgeeks.org/running-python-script-on-gpu/

不幸的是,我第一次尝试运行 GPU 代码失败了:

from numba import jit, cuda 
import numpy as np 
# to measure exec time 
from timeit import default_timer as timer 

# normal function to run on cpu 
def func(a):                                 
    for i in range(10000000): 
        a[i]+= 1    

# function optimized to run on gpu 
@jit(target ="cuda")                         
def func2(a): 
    for i in range(10000000): 
        a[i]+= 1
if __name__=="__main__": 
    n = 10000000                            
    a = np.ones(n, dtype = np.float64) 
    b = np.ones(n, dtype = np.float32) …
Run Code Online (Sandbox Code Playgroud)

python cuda gpu numba

9
推荐指数
1
解决办法
3983
查看次数

如何在 numba.njit 中进行离散傅里叶变换(FFT)?

各位程序员大家好

我正在尝试与装饰器一起制作discrete Fourier transform一个:minimal working examplenumba.njit

import numba
import numpy as np
import scipy
import scipy.fftpack

@numba.njit
def main():
    wave = [[[0.09254795,  0.10001078,  0.10744892, 0.07755555,  0.08506225, 0.09254795],
          [0.09907245,  0.10706145,  0.11502401,  0.08302302,  0.09105898, 0.09907245],
          [0.09565098,  0.10336405,  0.11105158,  0.08015589,  0.08791429, 0.09565098],
          [0.00181467,  0.001961,    0.00210684,  0.0015207,   0.00166789, 0.00181467]],
         [[-0.45816267, - 0.46058367, - 0.46289091, - 0.45298182, - 0.45562851, -0.45816267],
          [-0.49046506, - 0.49305676, - 0.49552669, - 0.48491893, - 0.48775223, -0.49046506],
          [-0.47352483, - 0.47602701, - 0.47841162, - 0.46817027, - 0.4709057, -0.47352483],
          [-0.00898358, …
Run Code Online (Sandbox Code Playgroud)

python numpy fft scipy numba

8
推荐指数
2
解决办法
6317
查看次数

如何配置tensorflow legacy/train.py model.cpk输出间隔

我试图解决由于过度拟合模型而导致的问题.不幸的是,我不知道如何提高的间隔model.cpklegacy/train.py训练中输出.有没有办法减少每次保存model.cpk和禁用删除之间的时间.我正在培训小型模型,可以满足更高的存储需求.

python tensorflow

7
推荐指数
1
解决办法
211
查看次数

节点管理器在 IdealTree 模块的 npm 安装期间卡住

这里是新的 mac 用户。我正在尝试在 phpstorm (laravel/laravel) 中创建一个作曲家项目,但每次运行npm install该过程时都会卡在:

\n
npm timing idealTree:userRequests Completed in 0ms\n\xe2\xb8\xa8\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xa0\x82\xe2\xb8\xa9 \xe2\xa0\xb8 idealTree:stuttard_staging: sill idealTree buildDeps\n
Run Code Online (Sandbox Code Playgroud)\n

完整的错误报告(大约 10 分钟冻结后):

\n
npm timing idealTree:buildDeps Completed in 1181143ms\nnpm timing idealTree:fixDepFlags Completed in 1ms\nnpm timing idealTree Completed in 1181150ms\nnpm timing command:i Completed in 1181156ms\nnpm verb type system\nnpm verb stack FetchError: request to http://registry.npmjs.org/axios failed, reason: connect ETIMEDOUT 2606:4700::6810:1123:80\nnpm verb stack     at ClientRequest.<anonymous> (/opt/homebrew/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:110:14)\nnpm verb stack     at ClientRequest.emit (node:events:390:28)\nnpm verb stack     at Socket.socketErrorListener (node:_http_client:447:9)\nnpm verb stack     at Socket.emit …
Run Code Online (Sandbox Code Playgroud)

node.js npm npm-install

7
推荐指数
1
解决办法
8437
查看次数

有什么方法可以在 Tailwind 中对伪选择器进行分组吗?

pseudo selectors顺风可以组团吗?

例如转换这个:

<div class="before:w-5 before:h-5">hello world</div>
Run Code Online (Sandbox Code Playgroud)

像这样的东西:

<div class="before:[w-5 h-5]">hello world</div>
Run Code Online (Sandbox Code Playgroud)

html tailwind-css

7
推荐指数
1
解决办法
1547
查看次数

如何使用 Stripe Checkout 获取动态价格?

我在页面上使用 Stripe 进行支付。该页面上有三个项目,每个项目都有一个根据页面上的输入动态设置的价格。我们将它们称为计划 A、B 和 C。我的 Stripe Checkout 成功地使用了硬编码的价格,但我需要根据单击的按钮和该商品的价值将价格传递给 Stripe。

PHP:

<?php require_once('/stripe/init.php');
\Stripe\Stripe::setApiKey('TEST KEY');

$session = new \Stripe\Checkout\Session::create([
    'payment_method_types' => ['card'],
    'line_items' => [[
      'price_data' => [
        'currency' => 'usd',
        'product_data' => [
          'name' => 'Insurance Plan',
        ],
        'unit_amount' => 4000, //need to set this dynamically
      ],
      'quantity' => 1,
    ]],
    'mode' => 'payment',
    'success_url' => 'https://example.com/success',
    'cancel_url' => 'https://example.com/cancel',
  ]);
?>
Run Code Online (Sandbox Code Playgroud)

JS:

<script>
var stripe = Stripe('PUB KEY');
    jQuery('.checkout-button').on('click', function(e) {
        e.preventDefault();
        var price = jQuery(this).find('.price').val(); //need to …
Run Code Online (Sandbox Code Playgroud)

javascript stripe-payments

6
推荐指数
3
解决办法
1万
查看次数

混合内容:“domain”处的页面是通过 HTTPS 加载的,但请求了不安全的 XMLHttpRequest 端点

我一直在尝试解决仅在生产中发生的错误。当我尝试create新的数据库条目时,会引发以下错误:

Mixed Content: The page at 'https://strong-moebel.art/admin/gallerie/neu' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://strong-moebel.art/admin/gallerie'. This request has been blocked; the content must be served over HTTPS.
Run Code Online (Sandbox Code Playgroud)
Uncaught (in promise) Error: Network Error
    at wh (main.750d1ea1.js:4:96980)
    at s.onerror (main.750d1ea1.js:5:1837)
Run Code Online (Sandbox Code Playgroud)

其他一切都有效,包括edit条目的方法。我正在使用一个resource controller. create方法使用惯性form.postedit方法使用其form.put(如果相关的话)。

我一直在尝试使用以下提供的解决方案来调试此问题:

  1. 混合内容问题 - 内容必须以 HTTPS 形式提供
  2. 混合内容(laravel)

基本上人们都说要添加:

if (App::environment('production')) {
    URL::forceScheme('https');
}
Run Code Online (Sandbox Code Playgroud)

按照boot()你的方法AppServiceProvider.php。我已经这样做了,但错误仍然出现。我想知道这是否是一个惯性问题。

在服务器上,我尝试过:

APP_ENV=production
APP_URL=http://localhost
APP_URL=https://localhost …
Run Code Online (Sandbox Code Playgroud)

ssl inertiajs laravel vue.js vuejs3

6
推荐指数
2
解决办法
2万
查看次数