我们正在努力在公司建立自己的表格 - 组件.我们试图像这样包装材料设计的组件:
领域:
<mat-form-field>
<ng-content></ng-content>
<mat-hint align="start"><strong>{{hint}}</strong> </mat-hint>
<mat-hint align="end">{{message.value.length}} / 256</mat-hint>
<mat-error>This field is required</mat-error>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)
文本框:
<field hint="hint">
<input matInput
[placeholder]="placeholder"
[value]="value"
(change)="onChange($event)"
(keydown)="onKeydown($event)"
(keyup)="onKeyup($event)"
(keypress)="onKeypress($event)">
</field>
Run Code Online (Sandbox Code Playgroud)
用法:
<textbox value="test" hint="my hint"></textbox>
Run Code Online (Sandbox Code Playgroud)
这导致大致如下:
<textbox placeholder="Personnummer/samordningsnummer" value="" ng-reflect-placeholder="Personnummer/samordningsnummer">
<field>
<mat-form-field class="mat-input-container mat-form-field>
<div class="mat-input-wrapper mat-form-field-wrapper">
<div class="mat-input-flex mat-form-field-flex">
<div class="mat-input-infix mat-form-field-infix">
<input _ngcontent-c4="" class="mat-input-element mat-form-field-autofill-control" matinput="" ng-reflect-placeholder="Personnummer/samordningsnummer" ng-reflect-value="" id="mat-input-2" placeholder="Personnummer/samordningsnummer" aria-invalid="false">
<span class="mat-input-placeholder-wrapper mat-form-field-placeholder-wrapper"></span>
</div>
</div>
<div class="mat-input-underline mat-form-field-underline">
<span class="mat-input-ripple mat-form-field-ripple"></span>
</div>
<div class="mat-input-subscript-wrapper mat-form-field-subscript-wrapper"></div>
</div>
</mat-form-field> …Run Code Online (Sandbox Code Playgroud) 我想知道为什么我的图像不显示。我想要的是我的图像在背景中,底部有两个按钮,在图像上方。我正在使用本机反应,以及用于应用程序的 IDE 'Deco'。现在根本没有图像显示:
import React, { Component } from 'react';
import { Button,Alert, TouchableOpacity,Image, Dimensions } from 'react-native'
import {
AppRegistry,
StyleSheet,
Text,
View,
} from 'react-native';
class Project extends Component {
render() {
return (
<View style={{backgroundColor: '#375D81', flex: 1}}>
<Image source={{uri: 'https://upload.wikimedia.org/wikipedia/commons/f/f0/Everest_North_Face_toward_Base_Camp_Tibet_Luca_Galuzzi_2006_edit_1.jpg'}}/>
<View style = {styles.container}>
<TouchableOpacity style = {styles.buttonText1} onPress={() => { Alert.alert('You tapped the button!')}}>
<Text style={styles.text}>
Button 1
</Text>
</TouchableOpacity>
<TouchableOpacity style = {styles.buttonText2} onPress={() => { Alert.alert('You tapped the button!')}}>
<Text style= {styles.text}>
Button …Run Code Online (Sandbox Code Playgroud) 我已经安装了firebase@9.0.1,使用纱线。该包看起来工作正常,但在按照给定的方式运行后就出现错误yarn install。
Module not found: Error: Package path . is not exported from package /Users/trinity/Projects/hello/node_modules/firebase (see exports field in /Users/trinity/Projects/hello/node_modules/firebase/package.json)\nRun Code Online (Sandbox Code Playgroud)\n仅供参考,在此处附加已安装的库集。
\n\xe2\x9e\x9c hello git:(main) \xe2\x9c\x97 yarn list --depth=0 | grep firebase\n\xe2\x94\x9c\xe2\x94\x80 @firebase/analytics-compat@0.1.1\n\xe2\x94\x9c\xe2\x94\x80 @firebase/analytics-types@0.7.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/analytics@0.7.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/app-check-compat@0.1.1\n\xe2\x94\x9c\xe2\x94\x80 @firebase/app-check-interop-types@0.1.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/app-check@0.4.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/app-compat@0.1.1\n\xe2\x94\x9c\xe2\x94\x80 @firebase/app-types@0.7.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/app@0.7.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/auth-compat@0.1.1\n\xe2\x94\x9c\xe2\x94\x80 @firebase/auth-interop-types@0.1.6\n\xe2\x94\x9c\xe2\x94\x80 @firebase/auth-types@0.11.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/auth@0.17.1\n\xe2\x94\x9c\xe2\x94\x80 @firebase/component@0.5.6\n\xe2\x94\x9c\xe2\x94\x80 @firebase/database-compat@0.1.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/database-types@0.9.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/database@0.12.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/firestore-compat@0.1.1\n\xe2\x94\x9c\xe2\x94\x80 @firebase/firestore-types@2.5.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/firestore@3.0.1\n\xe2\x94\x9c\xe2\x94\x80 @firebase/functions-compat@0.1.1\n\xe2\x94\x9c\xe2\x94\x80 @firebase/functions-types@0.5.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/functions@0.7.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/installations@0.5.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/logger@0.2.6\n\xe2\x94\x9c\xe2\x94\x80 @firebase/messaging-compat@0.1.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/messaging-interop-types@0.1.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/messaging@0.9.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/performance-compat@0.1.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/performance-types@0.1.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/performance@0.5.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/polyfill@0.3.36\n\xe2\x94\x9c\xe2\x94\x80 @firebase/remote-config-compat@0.1.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/remote-config-types@0.2.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/remote-config@0.2.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/storage-compat@0.1.1\n\xe2\x94\x9c\xe2\x94\x80 @firebase/storage-types@0.6.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/storage@0.8.1\n\xe2\x94\x9c\xe2\x94\x80 @firebase/util@1.3.0\n\xe2\x94\x9c\xe2\x94\x80 @firebase/webchannel-wrapper@0.5.1\n\xe2\x94\x9c\xe2\x94\x80 firebase@9.0.1\n\xe2\x9e\x9c hello …Run Code Online (Sandbox Code Playgroud) 我试图在我的应用程序中实现android.support.v4.app.ActionBarDrawerToggle; 因为这个类已被弃用
不推荐使用此类.请在support-v7-appcompat中使用ActionBarDrawerToggle.
我已切换到android.support.v7.app.ActionBarDrawerToggle.
在我以这种方式调用构造函数之前:
mDrawerToggle = new ActionBarDrawerToggle(
this, /* host Activity */
mDrawerLayout, /* DrawerLayout object */
R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
R.string.drawer_open, /* "open drawer" description for accessibility */
R.string.drawer_close /* "close drawer" description for accessibility */
){
public void onDrawerClosed(View view) {
getActionBar().setTitle(mTitle);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(mDrawerTitle);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
};
Run Code Online (Sandbox Code Playgroud)
但在我切换到较新的v7支持库后,我收到错误
"ActionBarDrawerToggle() in ActionBarDrawerToggle cannot be applied …Run Code Online (Sandbox Code Playgroud) 我正在使用 React 钩子作为应用程序状态,我想知道如何使用 props 初始化功能组件状态?该useState钩医生说确切的东西一样,
const [count, setCount] = useState(0);
Run Code Online (Sandbox Code Playgroud)
我想通过传递给组件的 props 值来初始化该 0 值。年长的,
import React from 'react';
export default class Sym extends React.Component{
constructor(props){
super(props);
this.state = {
sym : [0,3,2,8,5,4,1,6],
active: this.props.activeSym
}
this.setActive = this.setActive.bind(this);
}
setActive(itemIndex){
this.setState({
active: itemIndex
});
}
render(){
return (
<div><h1>{ this.state.sym[this.state.active]}</h1></div>
);
}
}
Run Code Online (Sandbox Code Playgroud)
工作正常。父组件传递activeSymprop 并且Sym组件使用this.props.activeSymin初始化状态 constructor 。是否有任何解决方法可以在功能组件中实现相同的功能?
我有 2 个 livewire 组件,第一个只显示购物车的会话变量,第二个只是在购物车中添加项目(带有 sku、标题、价格和数量的非常原始的表单)。
<livewire:shoppingcart :cart="$CartId">
<livewire:order-add-product-form :orderAddProductCartId="$CartId">
Run Code Online (Sandbox Code Playgroud)
这两个组件本身都运行良好。但是当我从第二个组件添加项目时,它会更新购物车会话变量,但视图永远不会更新。我必须刷新页面才能在购物车视图中查看会话变量。
是否可以将两个组件连接在一起。那么,当我从一个组件在购物车中添加项目时,它会自动更新其他组件的视图吗?
谢谢
我有 2 种构建口味,例如,flavor1 和 flavor2
我希望我的应用程序被命名为“AppFlavor1”,当我为flavor1 构建时,“AppFlavor2”当我为flavor 2 构建时
这是我的清单源代码片段
<application
android:name=".PApplication"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".ui.activities.SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
这是一个 gradle 文件的源代码片段
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
flavorDimensions "default"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
signingConfigs {
release {
}
}
buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors.whenObjectAdded { flavor -> …Run Code Online (Sandbox Code Playgroud) 我最近开发了一个带有electron框架的应用程序,在阅读了与电子 javascript 代码相关的安全问题后,我现在担心源代码保护。
我的意思是即使应用程序是为生产而构建的,也可以对代码进行逆向工程。我的应用程序包含许多关键信息,例如GitHub Private TokenAutoUpdate 等等。
我刚刚浏览了很多 SO 帖子,但没有找到完美的答案,所以解决了这个问题。使用电子无法混淆 javascript 代码或源代码保护?然而,混淆并不能完全保护代码,但它会使逆向工程变得复杂。如果有解决方法,请告诉我。我没有tl;dr在电子的安全相关帖子中找到更多内容。
我通过obfuscator找到了一种混淆方法,但似乎它需要手动混淆,并且没有更多关于源代码保护的信息,例如NW.js有没有更好的方法来实现它?
我在Medium post上发现了一些有助于混淆的东西。但没有找到任何关于源保护的信息。
这是我在 React-Native 屏幕中定义的样式。我已经使用该elevation
属性来实现框阴影。但它不能正常工作。
const styles = StyleSheet.create({
scrollContainer: {
flex: 1,
},
container: {
flex: 1,
flexDirection: "row",
flexWrap: "wrap",
padding: 2
},
box: {
margin: 8,
width: Dimensions.get('window').width / 2 - 18,
height: Dimensions.get('window').width / 2 - 18,
justifyContent: "center",
alignItems: "center",
borderStyle: 'dashed',
borderLeftWidth: 1,
borderTopWidth: 1,
borderRightWidth: 1,
borderBottomWidth: 1,
borderTopColor: 'black',
borderBottomEndRadius : 8,
borderTopStartRadius: 8,
borderTopEndRadius: 8,
borderBottomStartRadius: 8,
borderBottomLeftRadius:8,
borderBottomRightRadius:8,
elevation: 5
},
navBar:{
backgroundColor: "#000",
}
});
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用 box-shadow 但出现了同样的问题。
我正在测试我的应用程序在(Coolpad(Lolipop MRI)、Samsung Galaxy grand neo(Kitkat)、Redmi(Marshmallow)、Lenovo z2 plus(Marshmallow))等设备上的动作叠加,以在来电屏幕上显示对话。事情似乎适用于 lenovo z2 plus() 以外的设备。
正式直接请求许可我得到了例外:
public void testPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE);
}
}
}
Run Code Online (Sandbox Code Playgroud)
android.content.ActivityNotFoundException: 没有找到处理 Intent { act=android.settings.action.MANAGE_OVERLAY_PERMISSION 的活动
现在我将请求许可更改为:
public void testPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
if (intent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(intent, ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
但它仍然无法在 zuk 2 中请求许可。感谢立即提供帮助。