我创建了一个新的产品类型“ Crush Video Product”。它从其自定义选项卡正确保存所有元字段。
// add a product type
add_filter( 'product_type_selector', 'crush_add_custom_product_type' );
function crush_add_custom_product_type( $types ){
$types[ 'crush_video_product' ] = __( 'Group Video Class' );
return $types;
}
// Initiate Class when plugin is loaded
add_action( 'plugins_loaded', 'crush_create_custom_product_type' );
function crush_create_custom_product_type(){
// declare the product class
class WC_Product_Crush_Video_Product extends WC_Product{
public function __construct( $product ) {
$this->product_type = 'crush_video_product';
parent::__construct( $product );
// add additional functions here
}
// Needed since Woocommerce version 3
public function get_type() { …Run Code Online (Sandbox Code Playgroud) 我试图将data-countdown组件中的值(日期和时间)获取到 中x-data,以便我可以从中创建一个倒计时器。
我浏览了文档,但找不到任何可以帮助我获得价值的内容。我习惯x-model输入的值,但由于这不会改变,所以我只需要访问该值。
我尝试了一下,x-bind但没有运气。
这是一个刀片文件。我在 root-sage 中使用这个。
<div class='countdown' x-bind:data-countdown="{ 'time': {{ $class[time][day] }} {{ $class[time][time] }} }">
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的 JavaScript 代码。
window.singleGroupClass = function () {
return {
data: 'hey',
time: console.log(this.el),
countdown() {
console.log(this);
},
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个工作流程,deployment.yml如下所示:
name: Deployment
on:
push:
branches: [ production ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1.1.0
with:
version: 10.x
- name: Install dependencies
run: |
composer install -o
yarn
- name: Build
run: yarn build:production
- name: Sync
env:
dest: 'user@server:/var/www/html/wp-content/themes/theme-name'
run: |
echo "${{secrets.DEPLOY_KEY}}" > deploy_key
chmod 600 ./deploy_key
rsync -chav --delete \
-e 'ssh -i ./deploy_key -o StrictHostKeyChecking=no' \
--exclude /deploy_key \
--exclude /.git/ \
--exclude /.github/ \
--exclude /node_modules/ \
./ …Run Code Online (Sandbox Code Playgroud)