小编ali*_*ian的帖子

将字符串波斯日期转换为格里高利日期时间

要将字符串波斯语日期转换为格里高利语DateTime,我使用日期时间选择器,它会向我发送一个字符串"????/??/??"

PersianCalendar p = new PersianCalendar();               
string[] d = start.Split('/');           
DateTime dt = new DateTime(int.Parse(d[0]), 
                           int.Parse(d[1]),
                           int.Parse(d[2]),
                           new HijriCalendar());
Run Code Online (Sandbox Code Playgroud)

和我转换的函数是

public static DateTime ToGregorianDate(this DateTime dt)
{
     PersianCalendar pc = new PersianCalendar();
     return pc.ToDateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0, 0);    
}
Run Code Online (Sandbox Code Playgroud)

它给出了DateTime如何DateTime 在转换时发送正确显示此错误:

输入字符串的格式不正确.

c# datetime calendar

7
推荐指数
2
解决办法
4563
查看次数

Next JS Image Component适用于静态图片文件,但动态url无法加载图片

我正在使用 NextJS<Image />组件。我使用本地图像源和外部 API 源。一切都在我的本地开发环境中运行,但是一旦我将其托管在服务器上进行生产,来自 API 的动态图像就不会显示。

<Image
  src="house.jpg"   // loaded from local and works fine
  alt="Picture of my house."
  width={250}
  height={250}
/> 
Run Code Online (Sandbox Code Playgroud)

下面的代码适用于开发环境,但不适用于生产服务器。

const renderHouses = (apiHouses) => (
   apiHouses.map(house => (
      <div key={house.id}>
         <Image
           src={house.img}   // not working (loading) on production server
           alt={`Picture of ${house.name}`}
           width={250}
           height={250}
         /> 
      </div>
   ))
)

Run Code Online (Sandbox Code Playgroud)

reactjs next.js

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

有没有办法在 Vue 3 Composition API 中的随机组件之间共享反应数据?

“组件 A”中有一些反应性常量,可能会在某些用户操作后更新,如何将这些数据导入到另一个组件中?例如:

const MyComponent = {
      import { computed, ref } from "vue";
      setup() {
        name: "Component A",
        setup() {
          const foo = ref(null);
          
          const updateFoo = computed(() => foo.value = "bar");
          
          return { foo }
        }
      }
    }
Run Code Online (Sandbox Code Playgroud)

'foo' 的更新值可以在另一个组件中使用而不使用提供/注入吗?

我对 Vue 生态系统还很陌生;如果这是我在这里遗漏的明显内容,我深表歉意。

vue.js vuejs3 vue-composition-api

2
推荐指数
1
解决办法
4059
查看次数