小编Mar*_*ber的帖子

使用 script type="module" 在现有主页中添加 Vue-Component

我目前在现有的 Flask(服务器渲染)主页上使用 VueJS。我想用脚本标签导入一个 VueJS 组件。VueJS 组件应该从第三个 JS 文件访问 API 函数。Cue-Component-File 如下所示:

import {getContactsForNewMessageAPI} from "../../api/contactsAPI";

Vue.component('new-message-modal', {
    data: function () {
        return {
            selectFieldOptions: [],
            //... further attributes
        }
    },
    methods: {
        async getContacts(){
            this.selectFieldOptions = await getContactsForNewMessageAPI();
        },
        //... further methods
    }
});

Run Code Online (Sandbox Code Playgroud)

选项1:

在模板文件中,我可以像这样导入 VueJS-Component:

import {getContactsForNewMessageAPI} from "../../api/contactsAPI";

Vue.component('new-message-modal', {
    data: function () {
        return {
            selectFieldOptions: [],
            //... further attributes
        }
    },
    methods: {
        async getContacts(){
            this.selectFieldOptions = await getContactsForNewMessageAPI();
        },
        //... further methods
    }
}); …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js

6
推荐指数
0
解决办法
502
查看次数

xCode Cocoapods 构建失败“架构 x86_64 的未定义符号”

我想为模拟器和真实设备构建我的 Xcode 项目(react native & swift)。

模拟器效果很好。今天我尝试为我的设备构建它,我在 Xcode 栏中选择了我的设备并添加了要发布的方案(我必须这样做,因为我使用的是 React Native,否则捆绑包未打包)

然后在构建过程中会发生错误(在本例中为依赖项 RNPurchases,但这完全是随机的。有时是 Expo-Keep-Awake 或 Facebook)

Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_RCPurchases", referenced from:
  objc-class-ref in RNPurchases.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

即使在我的方案中切换回构建配置也Debug不再有效。

我已经尝试过几件事:

  • 清除 Xcode 构建
  • 删除 Pod 文件夹
  • 删除 Pod 缓存
  • 删除 Xcode/DerivedData
  • 重启

没有任何效果。

这个问题对我来说很新,在过去两个月内已经出现过两次。不知何故,我再次运行了模拟器的构建,但从未运行过设备。半年前我还没有出现过这样的问题...

我的设置

  • Xcode 12.4
  • MacBook Pro(大苏尔 11.2.3)
  • 应用程序目标的构建设置:仅构建活动架构:调试是,发布否)
  • Pod-Target 的构建设置:仅构建活动架构:调试是,发布否)
  • 播客文件:

    require_relative '../node_modules/react-native/scripts/react_native_pods'
    require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' …
Run Code Online (Sandbox Code Playgroud)

xcode ios cocoapods swift react-native

5
推荐指数
1
解决办法
9621
查看次数

标签 统计

cocoapods ×1

ios ×1

javascript ×1

react-native ×1

swift ×1

vue.js ×1

xcode ×1